Skip to content

Commit 26eceaf

Browse files
committed
feat(scim): SCIM /Users endpoints and bearer-token middleware
1 parent 0907af9 commit 26eceaf

36 files changed

Lines changed: 2120 additions & 499 deletions

‎go.mod‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ require (
8888
github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d // indirect
8989
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect
9090
github.com/spf13/pflag v1.0.6 // indirect
91-
github.com/stretchr/objx v0.5.2 // indirect
91+
github.com/stretchr/objx v0.5.3 // indirect
92+
github.com/supabase-community/scim-go v0.1.0 // indirect
9293
github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe // indirect
9394
github.com/tinylib/msgp v1.6.4 // indirect
9495
github.com/x448/float16 v0.8.4 // indirect
@@ -130,7 +131,7 @@ require (
130131
github.com/go-webauthn/webauthn v0.16.5
131132
github.com/gobuffalo/pop/v6 v6.1.1
132133
github.com/gobwas/glob v0.2.3
133-
github.com/gofrs/uuid v4.3.1+incompatible
134+
github.com/gofrs/uuid v4.4.0+incompatible
134135
github.com/golang-jwt/jwt/v5 v5.3.1
135136
github.com/jackc/pgconn v1.14.3
136137
github.com/jackc/pgerrcode v0.0.0-20201024163028-a0d42d470451
@@ -150,7 +151,7 @@ require (
150151
github.com/sirupsen/logrus v1.9.3
151152
github.com/spf13/cobra v1.8.1
152153
github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20240303152453-e0e82adf1721
153-
github.com/stretchr/testify v1.11.1
154+
github.com/stretchr/testify v1.12.1
154155
github.com/supabase/hibp v0.0.0-20231124125943-d225752ae869
155156
github.com/xeipuuv/gojsonschema v1.2.0
156157
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.64.0

‎go.sum‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx
186186
github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
187187
github.com/gofrs/uuid v4.3.1+incompatible h1:0/KbAdpx3UXAx1kEOWHJeOkpbgRFGHVgv+CFIY7dBJI=
188188
github.com/gofrs/uuid v4.3.1+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
189+
github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
190+
github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
189191
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=
190192
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
191193
github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY=
@@ -426,6 +428,8 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS
426428
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
427429
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
428430
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
431+
github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4=
432+
github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0=
429433
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
430434
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
431435
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
@@ -437,6 +441,10 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
437441
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
438442
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
439443
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
444+
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
445+
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
446+
github.com/supabase-community/scim-go v0.1.0 h1:gAWzYP2cewTTrp4c0nfPlcLFH4X0eK5hJPFlO5OaGnA=
447+
github.com/supabase-community/scim-go v0.1.0/go.mod h1:3UXuoz0bce+BQlY0VvMnAjOqcfssWgyj4iTheoXMpG8=
440448
github.com/supabase/hibp v0.0.0-20231124125943-d225752ae869 h1:VDuRtwen5Z7QQ5ctuHUse4wAv/JozkKZkdic5vUV4Lg=
441449
github.com/supabase/hibp v0.0.0-20231124125943-d225752ae869/go.mod h1:eHX5nlSMSnyPjUrbYzeqrA8snCe2SKyfizKjU3dkfOw=
442450
github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe h1:nbdqkIGOGfUAD54q1s2YBcBz/WcsxCO9HUQ4aGV5hUw=

‎internal/api/api.go‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func NewAPIWithVersion(globalConfig *conf.GlobalConfiguration, db *storage.Conne
138138
api.oauthServer = oauthserver.NewServer(globalConfig, db, api.tokenService)
139139
}
140140

141-
api.scim = scim.NewServer(globalConfig)
141+
api.scim = scim.NewServer(db, globalConfig.API.ExternalURL)
142142

143143
if api.config.Password.HIBP.Enabled {
144144
httpClient := &http.Client{
@@ -467,7 +467,16 @@ func NewAPIWithVersion(globalConfig *conf.GlobalConfiguration, db *storage.Conne
467467

468468
r.Get("/ServiceProviderConfig", api.scim.ServiceProviderConfig)
469469
r.Get("/ResourceTypes", api.scim.ResourceTypes)
470+
r.Get("/ResourceTypes/{id}", api.scim.ResourceTypeByID)
470471
r.Get("/Schemas", api.scim.Schemas)
472+
r.Get("/Schemas/{id}", api.scim.SchemaByID)
473+
474+
tenant := r.WithBypass(api.scim.Tenant)
475+
tenant.Get("/Users", api.scim.Users)
476+
tenant.Post("/Users", api.scim.CreateUser)
477+
tenant.Get("/Users/{id}", api.scim.UserByID)
478+
tenant.Put("/Users/{id}", api.scim.ReplaceUser)
479+
tenant.Delete("/Users/{id}", api.scim.DeleteUser)
471480
})
472481
})
473482

‎internal/api/scim/core/core.go‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎internal/api/scim/core/endpoints.go‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎internal/api/scim/core/meta.go‎

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎internal/api/scim/core/meta_test.go‎

Lines changed: 0 additions & 39 deletions
This file was deleted.

‎internal/api/scim/core/schemas.go‎

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎internal/api/scim/core/service_provider_config.go‎

Lines changed: 0 additions & 70 deletions
This file was deleted.

‎internal/api/scim/core/service_provider_config_test.go‎

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)