Documentation
¶
Index ¶
- Constants
- Variables
- func AppendQuery(uri string, params url.Values) string
- func IsSupportedGrant(grant string) bool
- func IsValidPKCEChallenge(codeChallenge, method string) bool
- func OAuthErrorRedirect(redirectURI, errCode, state string) events.APIGatewayProxyResponse
- func OAuthErrorResp(status int, code, description string) events.APIGatewayProxyResponse
- func ResetDiscoveryCachesForTest()
- func ValidateResponseType(responseType string) string
- type AuthServerMetadata
- type DiscoveredEndpoints
- type OAuthError
- type OIDCProviderMetadata
Constants ¶
View Source
const ( OIDCDiscoveryPath = "/.well-known/openid-configuration" OAuthASMetaPath = "/.well-known/oauth-authorization-server" OAuthPRMetaPath = "/.well-known/oauth-protected-resource" JWKSPath = "/.well-known/jwks.json" )
View Source
const ( ResponseTypeCode = "code" GrantAuthorizationCode = "authorization_code" GrantRefreshToken = "refresh_token" PKCEMethodS256 = "S256" TokenTypeBearer = "Bearer" TokenAuthNone = "none" TokenAuthBasic = "client_secret_basic" TokenAuthPost = "client_secret_post" )
View Source
const ( OAuthErrInvalidRequest = "invalid_request" OAuthErrInvalidClient = "invalid_client" OAuthErrInvalidGrant = "invalid_grant" OAuthErrUnsupportedGrantType = "unsupported_grant_type" OAuthErrInvalidScope = "invalid_scope" OAuthErrServerError = "server_error" OAuthErrUnsupportedResponseType = "unsupported_response_type" OAuthErrAccessDenied = "access_denied" )
View Source
const SigningKeyID = "1"
Variables ¶
View Source
var ( SupportedResponseTypes = []string{ResponseTypeCode} SupportedGrantTypes = []string{GrantAuthorizationCode, GrantRefreshToken} SupportedPKCEMethods = []string{PKCEMethodS256} SupportedTokenEndpointAuthMethods = []string{TokenAuthBasic, TokenAuthPost} SupportedRevocationEndpointAuthMethods = []string{TokenAuthBasic} SupportedScopes = []string{scopeOpenID, scopeEmail, scopeProfile, scopePhone} SupportedClaims = []string{"sub", "email", "phone_number", "name", "locale", "picture"} )
Functions ¶
func IsSupportedGrant ¶
func IsValidPKCEChallenge ¶
func OAuthErrorRedirect ¶
func OAuthErrorRedirect(redirectURI, errCode, state string) events.APIGatewayProxyResponse
func OAuthErrorResp ¶
func OAuthErrorResp(status int, code, description string) events.APIGatewayProxyResponse
func ResetDiscoveryCachesForTest ¶
func ResetDiscoveryCachesForTest()
func ValidateResponseType ¶
Types ¶
type AuthServerMetadata ¶
type AuthServerMetadata struct {
Issuer string `json:"issuer"`
AuthorizationEndpoint string `json:"authorization_endpoint"`
TokenEndpoint string `json:"token_endpoint"`
RevocationEndpoint string `json:"revocation_endpoint"`
JWKSURI string `json:"jwks_uri"`
ResponseTypesSupported []string `json:"response_types_supported"`
GrantTypesSupported []string `json:"grant_types_supported"`
ScopesSupported []string `json:"scopes_supported"`
CodeChallengeMethodsSupported []string `json:"code_challenge_methods_supported"`
TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"`
RevocationEndpointAuthMethodsSupported []string `json:"revocation_endpoint_auth_methods_supported"`
}
func BuildAuthServerMetadata ¶
func BuildAuthServerMetadata(issuer, apiBase string) AuthServerMetadata
type DiscoveredEndpoints ¶
type DiscoveredEndpoints struct {
AuthorizeURL string `json:"authorization_endpoint"`
TokenURL string `json:"token_endpoint"`
UserinfoURL string `json:"userinfo_endpoint"`
JWKSURI string `json:"jwks_uri"`
}
func ResolveIssuerEndpoints ¶
func ResolveIssuerEndpoints(ctx context.Context, issuer string, client httpclient.Client) (DiscoveredEndpoints, error)
type OAuthError ¶
type OIDCProviderMetadata ¶
type OIDCProviderMetadata struct {
Issuer string `json:"issuer"`
AuthorizationEndpoint string `json:"authorization_endpoint"`
TokenEndpoint string `json:"token_endpoint"`
UserinfoEndpoint string `json:"userinfo_endpoint"`
RevocationEndpoint string `json:"revocation_endpoint"`
JWKSURI string `json:"jwks_uri"`
ResponseTypesSupported []string `json:"response_types_supported"`
GrantTypesSupported []string `json:"grant_types_supported"`
SubjectTypesSupported []string `json:"subject_types_supported"`
IDTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported"`
ScopesSupported []string `json:"scopes_supported"`
ClaimsSupported []string `json:"claims_supported"`
CodeChallengeMethodsSupported []string `json:"code_challenge_methods_supported"`
TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"`
RevocationEndpointAuthMethodsSupported []string `json:"revocation_endpoint_auth_methods_supported"`
}
func BuildOIDCMetadata ¶
func BuildOIDCMetadata(issuer, apiBase string) OIDCProviderMetadata
Click to show internal directories.
Click to hide internal directories.