summaryrefslogtreecommitdiff
path: root/pkg/oidc
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-05-15 11:41:16 -0600
committermo khan <mo@mokhan.ca>2025-05-15 11:41:16 -0600
commitca3fb0f032ab338a10379807d97e0d31c3afca35 (patch)
tree6c4e551eb761fe525f6a385a9f3842598363d150 /pkg/oidc
parent48800c5e4e9d458ba7b6a9ab375810380091bdbb (diff)
refactor: move NewOIDCProvider to web package
Diffstat (limited to 'pkg/oidc')
-rw-r--r--pkg/oidc/provider.go27
-rw-r--r--pkg/oidc/test_server.go6
2 files changed, 2 insertions, 31 deletions
diff --git a/pkg/oidc/provider.go b/pkg/oidc/provider.go
deleted file mode 100644
index 31f7577..0000000
--- a/pkg/oidc/provider.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package oidc
-
-import (
- "context"
-
- "github.com/coreos/go-oidc/v3/oidc"
-)
-
-func NewProvider(ctx context.Context, issuer string, report func(error)) *oidc.Provider {
- provider, err := oidc.NewProvider(ctx, issuer)
- if err == nil {
- return provider
- }
-
- report(err)
-
- config := &oidc.ProviderConfig{
- IssuerURL: issuer,
- AuthURL: issuer + "/oauth/authorize",
- TokenURL: issuer + "/oauth/token",
- DeviceAuthURL: "",
- UserInfoURL: issuer + "/oauth/userinfo",
- JWKSURL: issuer + "/oauth/disovery/keys",
- Algorithms: []string{"RS256"},
- }
- return config.NewProvider(ctx)
-}
diff --git a/pkg/oidc/test_server.go b/pkg/oidc/test_server.go
index 81b37ca..80f2c9a 100644
--- a/pkg/oidc/test_server.go
+++ b/pkg/oidc/test_server.go
@@ -29,10 +29,8 @@ func NewTestServer(t *testing.T) *TestServer {
next.ServeHTTP(w, r)
})
})
-
- provider := NewProvider(t.Context(), srv.Issuer(), func(err error) {
- require.NoError(t, err)
- })
+ provider, err := oidc.NewProvider(t.Context(), srv.Issuer())
+ require.NoError(t, err)
return &TestServer{
srv,