Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCouldNotBuildURL = errors.New("could not build URL") ErrCouldNotCreateHTTPRequest = errors.New("could not create HTTP request") ErrCouldNotDoHTTPRequest = errors.New("could not do HTTP request") ErrCouldNotReadResponseBody = errors.New("could not read response body") ErrNoIntrospectionEndpoint = errors.New("no introspection endpoint in configuration") )
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct {
Issuer string `json:"issuer,omitempty"`
AuthorizationEndpoint string `json:"authorization_endpoint,omitempty"`
TokenEndpoint string `json:"token_endpoint,omitempty"`
UserinfoEndpoint string `json:"userinfo_endpoint,omitempty"`
JwksURI string `json:"jwks_uri,omitempty"`
ResponseTypesSupported []string `json:"response_types_supported,omitempty"`
GrantTypesSupported []string `json:"grant_types_supported,omitempty"`
SubjectTypesSupported []string `json:"subject_types_supported,omitempty"`
IDTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported,omitempty"`
ScopesSupported []string `json:"scopes_supported,omitempty"`
TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported,omitempty"`
ClaimsSupported []string `json:"claims_supported,omitempty"`
// From https://datatracker.ietf.org/doc/html/rfc7662
IntrospectionEndpoint string `json:"introspection_endpoint,omitempty"`
// From https://openid.net/specs/openid-connect-rpinitiated-1_0.html#OPMetadata
EndSessionEndpoint string `json:"end_session_endpoint,omitempty"`
// HTTPClient is the HTTP client to use for certain requests to this OpenID Provider.
// If nil, http.DefaultClient is used.
HTTPClient *http.Client `json:"-"`
}
Configuration is the meta data describing the configuration of an OpenID Provider. It can be onbtained from the .well-known/openid-configuration endpoint. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata for details.
func GetConfig ¶
func GetConfig(ctx context.Context, issuerURL string) (Configuration, error)
GetConfig fetches the OpenID Provider configuration from the given issuer URL. Note that the issuer URL may be different from the "issuer" field in the returned configuration.
func (Configuration) IntrospectToken ¶
func (cfg Configuration) IntrospectToken(ctx context.Context, token string, additionalQueryParameter map[string]string) (IntrospectResponse, error)
IntrospectToken introspects the given token using the OpenID Provider's introspection endpoint.
type CouldNotDecodeResponseError ¶
func (CouldNotDecodeResponseError) Error ¶
func (e CouldNotDecodeResponseError) Error() string
type IntrospectResponse ¶
type IntrospectResponse struct {
Active bool `json:"active"`
Groups []string `json:"groups,omitempty"`
// Error response fields e.g. bad credentials
Error string `json:"error,omitempty"`
ErrorDescription string `json:"error_description,omitempty"`
}
IntrospectResponse represents the response from an introspection request.
type ProviderRespondedNon200Error ¶
func (ProviderRespondedNon200Error) Error ¶
func (e ProviderRespondedNon200Error) Error() string
Click to show internal directories.
Click to hide internal directories.