Documentation
¶
Overview ¶
Package handler provides a HTTP handler for the OpenID Connect Provider.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationRequest ¶
type AuthenticationRequest struct {
RedirectURI string
State string
Scope string // space separated string
Nonce string
CodeChallenge string
CodeChallengeMethod string
RawQuery url.Values
}
AuthenticationRequest represents a type of: https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
type CertificatesResponse ¶
type CertificatesResponse struct {
Keys []*CertificatesResponseKey `json:"keys"`
}
type CertificatesResponseKey ¶
type DiscoveryResponse ¶
type DiscoveryResponse 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"`
SubjectTypesSupported []string `json:"subject_types_supported"`
IDTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported"`
ScopesSupported []string `json:"scopes_supported"`
TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"`
ClaimsSupported []string `json:"claims_supported"`
CodeChallengeMethodsSupported []string `json:"code_challenge_methods_supported"`
}
type ErrorResponse ¶
type ErrorResponse struct {
Code string `json:"error"`
Description string `json:"error_description"`
}
ErrorResponse represents an error response described in the following section: 5.2 Error Response https://tools.ietf.org/html/rfc6749#section-5.2
func (*ErrorResponse) Error ¶
func (err *ErrorResponse) Error() string
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler provides a HTTP handler for the OpenID Connect Provider. You need to implement the Provider interface. Note that this skips some security checks and is only for testing.
type Provider ¶
type Provider interface {
Discovery() *DiscoveryResponse
GetCertificates() *CertificatesResponse
AuthenticateCode(req AuthenticationRequest) (code string, err error)
Exchange(req TokenRequest) (*TokenResponse, error)
AuthenticatePassword(username, password, scope string) (*TokenResponse, error)
Refresh(refreshToken string) (*TokenResponse, error)
}
Provider provides discovery and authentication methods. If an implemented method returns an ErrorResponse, the handler will respond 400 and corresponding json of the ErrorResponse. Otherwise, the handler will respond 500 and fail the current test.
type TokenRequest ¶
TokenRequest represents a type of: https://openid.net/specs/openid-connect-core-1_0.html#TokenRequest