Skip to content

Commit

Permalink
Upgrade dependencies
Browse files Browse the repository at this point in the history
Submodule:
github.com/googleapis/googleapis 32bc03653260356351854429bd7e2dfbf670d352

Direct:
github.com/goreleaser/goreleaser/v2 v2.2.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0
github.com/jellydator/ttlcache/v3 v3.3.0
github.com/plgd-dev/device/v2 v2.5.3-0.20240904102627-4c2719d9d856
github.com/plgd-dev/go-coap/v3 v3.3.5-0.20240904100911-1afdeb72cb92
github.com/plgd-dev/hub/v2 v2.24.1
go.opentelemetry.io/otel/trace v1.29.0
google.golang.org/grpc v1.66.1

Indirect:
cloud.google.com/go v0.112.2
cloud.google.com/go/auth v0.3.0
cloud.google.com/go/auth/oauth2adapt v0.2.2
cloud.google.com/go/iam v1.1.7
cloud.google.com/go/storage v1.40.0
code.gitea.io/sdk/gitea v0.19.0
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.12.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
github.com/Azure/azure-sdk-for-go/sdk/internal v1.9.0
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2
github.com/Microsoft/go-winio v0.6.2
github.com/anchore/quill v0.4.2
github.com/atc0005/go-teams-notify/v2 v2.11.0
github.com/aws/aws-sdk-go v1.55.3
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.15
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.5
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.7
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.5
github.com/aws/aws-sdk-go-v2/service/kms v1.31.0
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1
github.com/blacktop/go-dwarf v1.0.10
github.com/blacktop/go-macho v1.1.225
github.com/bufbuild/protocompile v0.14.1
github.com/caarlos0/env/v11 v11.2.2
github.com/caarlos0/log v0.4.6
github.com/charmbracelet/bubbletea v0.26.6
github.com/charmbracelet/lipgloss v0.12.1
github.com/charmbracelet/x/ansi v0.1.4
github.com/charmbracelet/x/exp/ordered v0.1.0
github.com/charmbracelet/x/input v0.1.0
github.com/charmbracelet/x/term v0.1.1
github.com/charmbracelet/x/windows v0.1.0
github.com/cpuguy83/go-md2man/v2 v2.0.4
github.com/distribution/reference v0.6.0
github.com/docker/cli v27.1.1+incompatible
github.com/docker/docker v27.1.1+incompatible
github.com/docker/go-connections v0.5.0
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f
github.com/gabriel-vasile/mimetype v1.4.4
github.com/go-json-experiment/json v0.0.0-20240815174924-0599f16bf0e2
github.com/google/go-containerregistry v0.20.2
github.com/google/go-github/v63 v63.0.0
github.com/google/ko v0.16.0
github.com/goreleaser/nfpm/v2 v2.39.0
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/jhump/protoreflect v1.17.0
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6
github.com/nats-io/nats.go v1.37.0
github.com/pelletier/go-toml/v2 v2.2.2
github.com/slack-go/slack v0.13.1
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
github.com/xanzy/go-gitlab v0.107.0
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e
go.mongodb.org/mongo-driver v1.16.1
go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.54.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0
go.opentelemetry.io/otel v1.29.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.29.0
go.opentelemetry.io/otel/metric v1.29.0
go.opentelemetry.io/otel/sdk v1.29.0
gocloud.dev v0.38.0
golang.org/x/crypto v0.27.0
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
golang.org/x/mod v0.21.0
golang.org/x/net v0.29.0
golang.org/x/oauth2 v0.23.0
golang.org/x/sys v0.25.0
golang.org/x/term v0.24.0
golang.org/x/text v0.18.0
golang.org/x/tools v0.25.0
google.golang.org/api v0.176.1
google.golang.org/genproto v0.0.0-20240415180920-8c6c420018be
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1
  • Loading branch information
Danielius1922 committed Sep 10, 2024
1 parent e72e9f8 commit 15eefaf
Show file tree
Hide file tree
Showing 18 changed files with 328 additions and 308 deletions.
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ linters:
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
- bidichk # Checks for dangerous unicode character sequences
- bodyclose # Checks whether HTTP response body is closed successfully
# - copyloopvar # Detects places where loop variables are copied
- copyloopvar # Detects places where loop variables are copied
- decorder # Check declaration order and count of types, constants, variables and functions
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
- dupl # Tool for code clone detection
Expand All @@ -33,7 +33,6 @@ linters:
- errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted.
- errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
- exportloopref # checks for pointers to enclosing loop variables
- forcetypeassert # finds forced type assertions
- gci # Gci control golang package import order and make it always deterministic.
- gocheckcompilerdirectives # Checks that go compiler directive comments (//go:) are valid.
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"MFG_CLIENT_APPLICATION_KEY": "${workspaceFolder}/.tmp/devsim/pki_certs/mfgclientapplicationkey.pem",
"TEST_OAUTH_SERVER_ID_TOKEN_PRIVATE_KEY": "${workspaceFolder}/.tmp/oauth-server/idTokenKey.pem",
"TEST_OAUTH_SERVER_ACCESS_TOKEN_PRIVATE_KEY": "${workspaceFolder}/.tmp/oauth-server/accessTokenKey.pem",
"M2M_OAUTH_SERVER_PRIVATE_KEY": "${workspaceFolder}/.tmp/oauth-server/m2mAccessTokenKey.pem",
"TEST_ROOT_CA_KEY": "${workspaceFolder}/.tmp/certs/rootcakey.pem",
"TEST_ROOT_CA_CERT": "${workspaceFolder}/.tmp/certs/rootcacrt.pem",
"TEST_CLOUD_SID": "adebc667-1f2b-41e3-bf5c-6d6eabc68cc6",
Expand All @@ -31,6 +32,6 @@
],
"go.useLanguageServer": true,
"gopls": {
"formatting.gofumpt": true,
"formatting.gofumpt": true,
},
}
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ UI_SEPARATOR ?= "--------UI--------"
OAUTH_SERVER_PATH = $(shell pwd)/.tmp/oauth-server
OAUTH_SERVER_ID_TOKEN_PRIVATE_KEY = $(OAUTH_SERVER_PATH)/idTokenKey.pem
OAUTH_SERVER_ACCESS_TOKEN_PRIVATE_KEY = $(OAUTH_SERVER_PATH)/accessTokenKey.pem
M2M_OAUTH_SERVER_ACCESS_TOKEN_PRIVATE_KEY = $(OAUTH_SERVER_PATH)/m2mAccessTokenKey.pem
CLOUD_SID = adebc667-1f2b-41e3-bf5c-6d6eabc68cc6

certificates:
Expand Down Expand Up @@ -68,6 +69,8 @@ privateKeys:
mkdir -p $(OAUTH_SERVER_PATH)
openssl genrsa -out $(OAUTH_SERVER_ID_TOKEN_PRIVATE_KEY) 4096
openssl ecparam -name prime256v1 -genkey -noout -out $(OAUTH_SERVER_ACCESS_TOKEN_PRIVATE_KEY)
openssl ecparam -name prime256v1 -genkey -noout -out $(M2M_OAUTH_SERVER_ACCESS_TOKEN_PRIVATE_KEY)

.PHONY: privateKeys

env: clean certificates privateKeys nats mongo
Expand Down Expand Up @@ -119,6 +122,7 @@ test: env
export MFG_CLIENT_APPLICATION_KEY=$(MFG_CLIENT_APPLICATION_KEY); \
export TEST_OAUTH_SERVER_ID_TOKEN_PRIVATE_KEY=$(OAUTH_SERVER_ID_TOKEN_PRIVATE_KEY); \
export TEST_OAUTH_SERVER_ACCESS_TOKEN_PRIVATE_KEY=$(OAUTH_SERVER_ACCESS_TOKEN_PRIVATE_KEY); \
export M2M_OAUTH_SERVER_PRIVATE_KEY=$(M2M_OAUTH_SERVER_ACCESS_TOKEN_PRIVATE_KEY); \
export TEST_ROOT_CA_KEY=$(WORKING_DIRECTORY)/.tmp/certs/rootcakey.pem; \
export TEST_ROOT_CA_CERT=$(WORKING_DIRECTORY)/.tmp/certs/rootcacrt.pem; \
export TEST_COAP_GW_CERT_FILE=$(WORKING_DIRECTORY)/.tmp/certs/coap.crt; \
Expand Down
2 changes: 1 addition & 1 deletion dependency/googleapis
Submodule googleapis updated 301 files
172 changes: 88 additions & 84 deletions go.mod

Large diffs are not rendered by default.

399 changes: 203 additions & 196 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/tar/tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func Untar(dst string, r io.Reader) error {
}
// if it's a file create it
case tar.TypeReg:
err := copyFile(target, os.FileMode(header.Mode), tr)
err := copyFile(target, os.FileMode(header.Mode), tr) //nolint:gosec
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion service/grpc/jsonWebKeyCache.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package grpc

import (
"context"
"errors"

"github.com/golang-jwt/jwt/v5"
Expand Down Expand Up @@ -51,7 +52,7 @@ func (c *JSONWebKeyCache) LookupKey(token *jwt.Token) (jwk.Key, error) {
return nil, errors.New("could not find JWK")
}

func (s *ClientApplicationServer) ParseWithClaims(token string, claims jwt.Claims) error {
func (s *ClientApplicationServer) ParseWithClaims(_ context.Context, token string, claims jwt.Claims) error {
if token == "" {
if !s.HasJWTAuthorizationEnabled() {
return nil
Expand Down
2 changes: 1 addition & 1 deletion service/grpc/updateJSONWebKeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (s *ClientApplicationServer) getOwnerForUpdateJSONWebKeys(ctx context.Conte
return owner, nil
}
scopedClaims := plgdJwt.NewScopeClaims()
err = s.ParseWithClaims(token, scopedClaims)
err = s.ParseWithClaims(ctx, token, scopedClaims)
if err != nil {
return "", status.Errorf(codes.Unauthenticated, "cannot parse token: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions service/http/clearCache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
plgdDevice "github.com/plgd-dev/device/v2/schema/device"
grpcgwPb "github.com/plgd-dev/hub/v2/grpc-gateway/pb"
httpgwTest "github.com/plgd-dev/hub/v2/http-gateway/test"
httpTest "github.com/plgd-dev/hub/v2/test/http"
pkgHttpPb "github.com/plgd-dev/hub/v2/pkg/net/http/pb"
"github.com/plgd-dev/kit/v2/codec/cbor"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -70,7 +70,7 @@ func TestClientApplicationServerClearCache(t *testing.T) {
assert.Equal(t, http.StatusOK, resp.StatusCode)

var device grpcgwPb.Device
err := httpTest.Unmarshal(resp.StatusCode, resp.Body, &device)
err := pkgHttpPb.Unmarshal(resp.StatusCode, resp.Body, &device)
require.NoError(t, err)

var v plgdDevice.Device
Expand Down
4 changes: 2 additions & 2 deletions service/http/getDeviceResourceLinks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import (
serviceHttp "github.com/plgd-dev/client-application/service/http"
"github.com/plgd-dev/client-application/test"
httpgwTest "github.com/plgd-dev/hub/v2/http-gateway/test"
pkgHttpPb "github.com/plgd-dev/hub/v2/pkg/net/http/pb"
"github.com/plgd-dev/hub/v2/resource-aggregate/commands"
"github.com/plgd-dev/hub/v2/resource-aggregate/events"
hubTest "github.com/plgd-dev/hub/v2/test"
httpTest "github.com/plgd-dev/hub/v2/test/http"
hubTestPb "github.com/plgd-dev/hub/v2/test/pb"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -88,7 +88,7 @@ func TestClientApplicationServerGetDeviceResourceLinks(t *testing.T) {
assert.Equal(t, tt.wantCode, resp.StatusCode)

var val events.ResourceLinksPublished
err := httpTest.Unmarshal(resp.StatusCode, resp.Body, &val)
err := pkgHttpPb.Unmarshal(resp.StatusCode, resp.Body, &val)
if tt.wantErr {
require.Error(t, err)
return
Expand Down
4 changes: 2 additions & 2 deletions service/http/getDevice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
plgdDevice "github.com/plgd-dev/device/v2/schema/device"
grpcgwPb "github.com/plgd-dev/hub/v2/grpc-gateway/pb"
httpgwTest "github.com/plgd-dev/hub/v2/http-gateway/test"
httpTest "github.com/plgd-dev/hub/v2/test/http"
pkgHttpPb "github.com/plgd-dev/hub/v2/pkg/net/http/pb"
"github.com/plgd-dev/kit/v2/codec/cbor"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -68,7 +68,7 @@ func TestClientApplicationServerGetDevice(t *testing.T) {
assert.Equal(t, http.StatusOK, resp.StatusCode)

var device grpcgwPb.Device
err := httpTest.Unmarshal(resp.StatusCode, resp.Body, &device)
err := pkgHttpPb.Unmarshal(resp.StatusCode, resp.Body, &device)
require.NoError(t, err)

var v plgdDevice.Device
Expand Down
6 changes: 3 additions & 3 deletions service/http/getDevices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/plgd-dev/client-application/test"
grpcgwPb "github.com/plgd-dev/hub/v2/grpc-gateway/pb"
httpgwTest "github.com/plgd-dev/hub/v2/http-gateway/test"
httpTest "github.com/plgd-dev/hub/v2/test/http"
pkgHttpPb "github.com/plgd-dev/hub/v2/pkg/net/http/pb"
"github.com/stretchr/testify/require"
)

Expand All @@ -44,7 +44,7 @@ func getDevices(t *testing.T, token string) {
require.Equal(t, http.StatusOK, resp.StatusCode)
for {
var dev grpcgwPb.Device
err := httpTest.Unmarshal(resp.StatusCode, resp.Body, &dev)
err := pkgHttpPb.Unmarshal(resp.StatusCode, resp.Body, &dev)
if errors.Is(err, io.EOF) {
break
}
Expand Down Expand Up @@ -116,7 +116,7 @@ func TestClientApplicationServerGetDevices(t *testing.T) {
var got []*grpcgwPb.Device
for {
var dev grpcgwPb.Device
err := httpTest.Unmarshal(resp.StatusCode, resp.Body, &dev)
err := pkgHttpPb.Unmarshal(resp.StatusCode, resp.Body, &dev)
if errors.Is(err, io.EOF) {
break
}
Expand Down
4 changes: 2 additions & 2 deletions service/http/getResource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (
"github.com/plgd-dev/device/v2/schema/device"
grpcgwPb "github.com/plgd-dev/hub/v2/grpc-gateway/pb"
httpgwTest "github.com/plgd-dev/hub/v2/http-gateway/test"
pkgHttpPb "github.com/plgd-dev/hub/v2/pkg/net/http/pb"
hubTest "github.com/plgd-dev/hub/v2/test"
httpTest "github.com/plgd-dev/hub/v2/test/http"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -111,7 +111,7 @@ func TestClientApplicationServerGetResource(t *testing.T) {
assert.Equal(t, tt.wantCode, resp.StatusCode)

var got grpcgwPb.Resource
err := httpTest.Unmarshal(resp.StatusCode, resp.Body, &got)
err := pkgHttpPb.Unmarshal(resp.StatusCode, resp.Body, &got)
if tt.wantErr {
require.Error(t, err)
return
Expand Down
5 changes: 3 additions & 2 deletions service/http/onboardDevice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ import (
hubGrpcGwPb "github.com/plgd-dev/hub/v2/grpc-gateway/pb"
httpgwTest "github.com/plgd-dev/hub/v2/http-gateway/test"
kitNetGrpc "github.com/plgd-dev/hub/v2/pkg/net/grpc"
pkgHttpPb "github.com/plgd-dev/hub/v2/pkg/net/http/pb"
hubTest "github.com/plgd-dev/hub/v2/test"
"github.com/plgd-dev/hub/v2/test/config"
"github.com/plgd-dev/hub/v2/test/device/ocf"
httpTest "github.com/plgd-dev/hub/v2/test/http"
hubTestOAuthServerTest "github.com/plgd-dev/hub/v2/test/oauth-server/test"
hubTestService "github.com/plgd-dev/hub/v2/test/service"
"github.com/stretchr/testify/require"
Expand All @@ -46,6 +46,7 @@ func TestClientApplicationServerOnboardDeviceRemoteProvisioning(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
tearDown := setupRemoteProvisioning(t, hubTestService.SetUpServicesOAuth|
hubTestService.SetUpServicesMachine2MachineOAuth|
hubTestService.SetUpServicesCertificateAuthority|
hubTestService.SetUpServicesId|
hubTestService.SetUpServicesCertificateAuthority|
Expand Down Expand Up @@ -130,7 +131,7 @@ func TestClientApplicationServerOnboardDeviceRemoteProvisioning(t *testing.T) {
require.Equal(t, http.StatusOK, resp.StatusCode)

var httpClientCfg pb.GetConfigurationResponse
err = httpTest.Unmarshal(resp.StatusCode, resp.Body, &httpClientCfg)
err = pkgHttpPb.Unmarshal(resp.StatusCode, resp.Body, &httpClientCfg)
require.NoError(t, err)

// oauth server url to host
Expand Down
5 changes: 3 additions & 2 deletions service/http/remoteInitialize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func setupRemoteProvisioning(t *testing.T, services ...hubTestService.SetUpServi

var service hubTestService.SetUpServicesConfig
if len(services) == 0 {
service = hubTestService.SetUpServicesOAuth | hubTestService.SetUpServicesCertificateAuthority
service = hubTestService.SetUpServicesOAuth | hubTestService.SetUpServicesMachine2MachineOAuth | hubTestService.SetUpServicesCertificateAuthority
} else {
for _, s := range services {
service |= s
Expand Down Expand Up @@ -191,7 +191,8 @@ func TestClientApplicationServerUpdateIdentityCertificate(t *testing.T) {
shutDown := test.New(t, cfg)
defer shutDown()

servicesShutdown := hubTestService.SetUpServices(ctx, t, hubTestService.SetUpServicesOAuth|hubTestService.SetUpServicesCertificateAuthority)
servicesShutdown := hubTestService.SetUpServices(ctx, t, hubTestService.SetUpServicesOAuth|
hubTestService.SetUpServicesMachine2MachineOAuth|hubTestService.SetUpServicesCertificateAuthority)
defer servicesShutdown()

request := httpgwTest.NewRequest(http.MethodGet, serviceHttp.WellKnownConfiguration, nil).Host(test.CLIENT_APPLICATION_HTTP_HOST).Build()
Expand Down
10 changes: 6 additions & 4 deletions service/http/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import (
"github.com/plgd-dev/hub/v2/pkg/fsnotify"
pkgLog "github.com/plgd-dev/hub/v2/pkg/log"
kitNetHttp "github.com/plgd-dev/hub/v2/pkg/net/http"
pkgHttpJwt "github.com/plgd-dev/hub/v2/pkg/net/http/jwt"
pkgHttpUri "github.com/plgd-dev/hub/v2/pkg/net/http/uri"
"go.opentelemetry.io/otel/trace"
)

Expand All @@ -55,7 +57,7 @@ type RequestHandler struct {
}

func splitURIPath(requestURI, prefix string) []string {
v := kitNetHttp.CanonicalHref(requestURI)
v := pkgHttpUri.CanonicalHref(requestURI)
p := strings.TrimPrefix(v, prefix) // remove core prefix
if p == v {
return nil
Expand All @@ -78,7 +80,7 @@ func resourceMatcher(r *http.Request, rm *router.RouteMatch) bool {
}

func createAuthFunc(config configHttp.Config, clientApplicationServer *grpc.ClientApplicationServer) func(ctx context.Context, method, uri string) (context.Context, error) {
whiteList := []kitNetHttp.RequestMatcher{
whiteList := []pkgHttpJwt.RequestMatcher{
{
Method: http.MethodGet,
URI: regexp.MustCompile(regexp.QuoteMeta(WellKnownJWKs)),
Expand All @@ -94,12 +96,12 @@ func createAuthFunc(config configHttp.Config, clientApplicationServer *grpc.Clie
},
}
if config.UI.Enabled {
whiteList = append(whiteList, kitNetHttp.RequestMatcher{
whiteList = append(whiteList, pkgHttpJwt.RequestMatcher{
Method: http.MethodGet,
URI: regexp.MustCompile(`^\/(a$|[^a].*|ap$|a[^p].*|ap[^i].*|api[^/])`),
})
}
auth := kitNetHttp.NewInterceptorWithValidator(clientApplicationServer, kitNetHttp.NewDefaultAuthorizationRules(ApiV1), whiteList...)
auth := pkgHttpJwt.NewInterceptorWithValidator(clientApplicationServer, kitNetHttp.NewDefaultAuthorizationRules(ApiV1), whiteList...)
return func(ctx context.Context, method, uri string) (context.Context, error) {
if clientApplicationServer.HasJWTAuthorizationEnabled() {
return auth(ctx, method, uri)
Expand Down
4 changes: 2 additions & 2 deletions service/http/updateResource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ import (
"github.com/plgd-dev/device/v2/schema/doxm"
grpcgwPb "github.com/plgd-dev/hub/v2/grpc-gateway/pb"
httpgwTest "github.com/plgd-dev/hub/v2/http-gateway/test"
pkgHttpPb "github.com/plgd-dev/hub/v2/pkg/net/http/pb"
"github.com/plgd-dev/hub/v2/resource-aggregate/commands"
"github.com/plgd-dev/hub/v2/resource-aggregate/events"
hubTest "github.com/plgd-dev/hub/v2/test"
httpTest "github.com/plgd-dev/hub/v2/test/http"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -140,7 +140,7 @@ func TestClientApplicationServerUpdateResource(t *testing.T) {
assert.Equal(t, tt.wantCode, resp.StatusCode)

var got grpcgwPb.UpdateResourceResponse
err := httpTest.Unmarshal(resp.StatusCode, resp.Body, &got)
err := pkgHttpPb.Unmarshal(resp.StatusCode, resp.Body, &got)
if tt.wantErr {
require.Error(t, err)
return
Expand Down

0 comments on commit 15eefaf

Please sign in to comment.