summaryrefslogtreecommitdiff
path: root/pkg/oidc/provider.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-05-14 17:05:41 -0600
committermo khan <mo@mokhan.ca>2025-05-14 17:05:41 -0600
commit7b74ddbe8478bbf901685cea7826d96f042c142e (patch)
tree4ced3a6a08af63ffbe89f66b9d5e4242140488b9 /pkg/oidc/provider.go
parent1f8849d5e9c69e0f489fcc5a4f638dde8c6b20db (diff)
feat: provider a fallback provider that defaults to hard-coded paths
Diffstat (limited to 'pkg/oidc/provider.go')
-rw-r--r--pkg/oidc/provider.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/pkg/oidc/provider.go b/pkg/oidc/provider.go
new file mode 100644
index 0000000..31f7577
--- /dev/null
+++ b/pkg/oidc/provider.go
@@ -0,0 +1,27 @@
+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)
+}