@@ -11,11 +11,12 @@ import (
1111
1212// providerJSON resresents the information we need from an OIDC discovery
1313type providerJSON struct {
14− Issuer string `json:"issuer"`
15− AuthURL string `json:"authorization_endpoint"`
16− TokenURL string `json:"token_endpoint"`
17− JWKsURL string `json:"jwks_uri"`
18− UserInfoURL string `json:"userinfo_endpoint"`
14+ Issuer string `json:"issuer"`
15+ AuthURL string `json:"authorization_endpoint"`
16+ TokenURL string `json:"token_endpoint"`
17+ JWKsURL string `json:"jwks_uri"`
18+ UserInfoURL string `json:"userinfo_endpoint"`
19+ CodeChallengeAlgs []string `json:"code_challenge_methods_supported"`
1920}
2021
2122// Endpoints represents the endpoints discovered as part of the OIDC discovery process
@@ -27,10 +28,17 @@ type Endpoints struct {
2728 UserInfoURL string
2829}
2930
31+// PKCE holds information relevant to the PKCE (code challenge) support of the
32+// provider.
33+type PKCE struct {
34+ CodeChallengeAlgs []string
35+}
36+
3037// DiscoveryProvider holds information about an identity provider having
3138// used OIDC discovery to retrieve the information.
3239type DiscoveryProvider interface {
3340 Endpoints() Endpoints
41+ PKCE() PKCE
3442}
3543
3644// NewProvider allows a user to perform an OIDC discovery and returns the DiscoveryProvider.
@@ -55,19 +63,21 @@ func NewProvider(ctx context.Context, issuerURL string, skipIssuerVerification b
5563 }
5664
5765 return &discoveryProvider{
58− authURL: p.AuthURL,
59− tokenURL: p.TokenURL,
60− jwksURL: p.JWKsURL,
61− userInfoURL: p.UserInfoURL,
66+ authURL: p.AuthURL,
67+ tokenURL: p.TokenURL,
68+ jwksURL: p.JWKsURL,
69+ userInfoURL: p.UserInfoURL,
70+ codeChallengeAlgs: p.CodeChallengeAlgs,
6271 }, nil
6372}
6473
6574// discoveryProvider holds the discovered endpoints
6675type discoveryProvider struct {
67− authURL string
68− tokenURL string
69− jwksURL string
70− userInfoURL string
76+ authURL string
77+ tokenURL string
78+ jwksURL string
79+ userInfoURL string
80+ codeChallengeAlgs []string
7181}
7282
7383// Endpoints returns the discovered endpoints needed for an authentication provider.
@@ -79,3 +89,10 @@ func (p *discoveryProvider) Endpoints() Endpoints {
7989 UserInfoURL: p.userInfoURL,
8090 }
8191}
92+
93+// PKCE returns information related to the PKCE (code challenge) support of the provider.
94+func (p *discoveryProvider) PKCE() PKCE {
95+ return PKCE{
96+ CodeChallengeAlgs: p.codeChallengeAlgs,
97+ }
98+}