diff --git a/api/openapi/auth.yml b/api/openapi/auth.yml index 73c2f8b101..06ba97969c 100644 --- a/api/openapi/auth.yml +++ b/api/openapi/auth.yml @@ -31,7 +31,7 @@ tags: externalDocs: description: Find out more about domains url: https://docs.magistrala.abstractmachines.fr/ - + - name: Health description: Service health check endpoint. externalDocs: diff --git a/api/openapi/clients.yml b/api/openapi/clients.yml index 8378449fc9..37f500bbdd 100644 --- a/api/openapi/clients.yml +++ b/api/openapi/clients.yml @@ -1100,9 +1100,12 @@ components: "bb7edb32-2eac-4aad-aebe-ed96fe073879", ] relation: - type: string - example: "editor" - description: Policy relation. + type: array + minItems: 0 + items: + type: string + example: ["m_write", "g_add"] + description: Policy relations. required: - user_ids - relation @@ -1123,7 +1126,7 @@ components: ] relation: type: string - example: "editor" + example: "m_write" description: Policy relations. member_kind: type: string @@ -1150,7 +1153,7 @@ components: ] relation: type: string - example: "editor" + example: "m_write" description: Policy relations. required: - users_ids diff --git a/cmd/auth/main.go b/cmd/auth/main.go index 58524c30c9..7c2f7c03af 100644 --- a/cmd/auth/main.go +++ b/cmd/auth/main.go @@ -19,6 +19,8 @@ import ( authgrpcapi "github.com/absmach/magistrala/auth/api/grpc/auth" tokengrpcapi "github.com/absmach/magistrala/auth/api/grpc/token" httpapi "github.com/absmach/magistrala/auth/api/http" + "github.com/absmach/magistrala/auth/bolt" + "github.com/absmach/magistrala/auth/hasher" "github.com/absmach/magistrala/auth/jwt" apostgres "github.com/absmach/magistrala/auth/postgres" "github.com/absmach/magistrala/auth/tracing" @@ -26,8 +28,6 @@ import ( grpcAuthV1 "github.com/absmach/magistrala/internal/grpc/auth/v1" grpcTokenV1 "github.com/absmach/magistrala/internal/grpc/token/v1" mglog "github.com/absmach/magistrala/logger" - "github.com/absmach/magistrala/auth/bolt" - "github.com/absmach/magistrala/auth/hasher" "github.com/absmach/magistrala/pkg/jaeger" "github.com/absmach/magistrala/pkg/policies/spicedb" "github.com/absmach/magistrala/pkg/postgres" @@ -244,7 +244,7 @@ func newService(_ context.Context, db *sqlx.DB, tracer trace.Tracer, cfg config, t := jwt.New([]byte(cfg.SecretKey)) - svc := auth.New(keysRepo,patsRepo, hasher, idProvider, t, pEvaluator, pService, cfg.AccessDuration, cfg.RefreshDuration, cfg.InvitationDuration) + svc := auth.New(keysRepo, patsRepo, hasher, idProvider, t, pEvaluator, pService, cfg.AccessDuration, cfg.RefreshDuration, cfg.InvitationDuration) svc = api.LoggingMiddleware(svc, logger) counter, latency := prometheus.MakeMetrics("auth", "api") svc = api.MetricsMiddleware(svc, counter, latency) diff --git a/docker/nginx/entrypoint.sh b/docker/nginx/entrypoint.sh index ade36d9bbc..eb2154a054 100755 --- a/docker/nginx/entrypoint.sh +++ b/docker/nginx/entrypoint.sh @@ -14,7 +14,6 @@ fi envsubst ' ${MG_NGINX_SERVER_NAME} ${MG_DOMAINS_HTTP_PORT} - ${MG_AUTH_HTTP_PORT} ${MG_GROUPS_HTTP_PORT} ${MG_USERS_HTTP_PORT} ${MG_CLIENTS_HTTP_PORT} diff --git a/docker/nginx/nginx-key.conf b/docker/nginx/nginx-key.conf index 423f0d0206..605aec4bb6 100644 --- a/docker/nginx/nginx-key.conf +++ b/docker/nginx/nginx-key.conf @@ -68,7 +68,7 @@ http { location ~ ^/(domains|keys|pats) { include snippets/proxy-headers.conf; add_header Access-Control-Expose-Headers Location; - proxy_pass http://auth:${MG_AUTH_HTTP_PORT}; + proxy_pass http://domains:${MG_DOMAINS_HTTP_PORT}; } # Proxy pass to users service diff --git a/go.mod b/go.mod index e664ff2622..cc1d34d97a 100644 --- a/go.mod +++ b/go.mod @@ -43,7 +43,8 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 github.com/sqids/sqids-go v0.4.1 - github.com/stretchr/testify v1.10.0 + github.com/sqids/sqids-go v0.4.1 + github.com/stretchr/testify v1.9.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.57.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0 go.opentelemetry.io/otel v1.32.0 diff --git a/go.sum b/go.sum index 6596f7d96e..775d1dc8a3 100644 --- a/go.sum +++ b/go.sum @@ -424,8 +424,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= diff --git a/pkg/sdk/go/health_test.go b/pkg/sdk/go/health_test.go index 7a4ca7c1c3..209f0ca265 100644 --- a/pkg/sdk/go/health_test.go +++ b/pkg/sdk/go/health_test.go @@ -11,14 +11,14 @@ import ( "github.com/absmach/magistrala" "github.com/absmach/magistrala/bootstrap/api" bmocks "github.com/absmach/magistrala/bootstrap/mocks" + chmocks "github.com/absmach/magistrala/channels/mocks" + climocks "github.com/absmach/magistrala/clients/mocks" mglog "github.com/absmach/magistrala/logger" authnmocks "github.com/absmach/magistrala/pkg/authn/mocks" - authzmocks "github.com/absmach/magistrala/pkg/authz/mocks" "github.com/absmach/magistrala/pkg/errors" sdk "github.com/absmach/magistrala/pkg/sdk/go" readersapi "github.com/absmach/magistrala/readers/api" readersmocks "github.com/absmach/magistrala/readers/mocks" - thmocks "github.com/absmach/magistrala/things/mocks" "github.com/stretchr/testify/assert" ) @@ -135,10 +135,10 @@ func setupMinimalBootstrap() *httptest.Server { func setupMinimalReader() *httptest.Server { repo := new(readersmocks.MessageRepository) - authz := new(authzmocks.Authorization) + channels := new(chmocks.ChannelsServiceClient) authn := new(authnmocks.Authentication) - things := new(thmocks.ThingsServiceClient) + clients := new(climocks.ClientsServiceClient) - mux := readersapi.MakeHandler(repo, authn, authz, things, "test", "") + mux := readersapi.MakeHandler(repo, authn, clients, channels, "test", "") return httptest.NewServer(mux) }