Documentation ¶
Index ¶
- Constants
- func AssertObjectKeysEqual(t *testing.T, a, b interface{}, keys ...string)
- func AssertObjectKeysNotEqual(t *testing.T, a, b interface{}, keys ...string)
- func RequireObjectKeysEqual(t *testing.T, a, b interface{}, keys ...string)
- func RequireObjectKeysNotEqual(t *testing.T, a, b interface{}, keys ...string)
- func TestHelperRunner(t *testing.T, store InternalRegistry, k string)
- type AccessRequestHook
- type AssertionJWTReader
- type BlacklistedJTI
- type Handler
- type InternalRegistry
- type Introspection
- type RefreshTokenHookRequest
- type Registry
- type Request
- type Requester
- type Session
- type TokenHookRequest
- type TokenHookResponse
Constants ¶
const ( DefaultLoginPath = "/oauth2/fallbacks/login" DefaultConsentPath = "/oauth2/fallbacks/consent" DefaultPostLogoutPath = "/oauth2/fallbacks/logout/callback" DefaultLogoutPath = "/oauth2/fallbacks/logout" DefaultErrorPath = "/oauth2/fallbacks/error" TokenPath = "/oauth2/token" // #nosec G101 AuthPath = "/oauth2/auth" LogoutPath = "/oauth2/sessions/logout" UserinfoPath = "/userinfo" WellKnownPath = "/.well-known/openid-configuration" JWKPath = "/.well-known/jwks.json" // IntrospectPath points to the OAuth2 introspection endpoint. IntrospectPath = "/oauth2/introspect" RevocationPath = "/oauth2/revoke" DeleteTokensPath = "/oauth2/tokens" // #nosec G101 )
Variables ¶
This section is empty.
Functions ¶
func AssertObjectKeysEqual ¶
func RequireObjectKeysEqual ¶
func TestHelperRunner ¶
func TestHelperRunner(t *testing.T, store InternalRegistry, k string)
TestHelperRunner is used to run the database suite of tests in this package. KEEP EXPORTED AND AVAILABLE FOR THIRD PARTIES TO TEST PLUGINS!
Types ¶
type AccessRequestHook ¶
type AccessRequestHook func(ctx context.Context, requester fosite.AccessRequester) error
AccessRequestHook is called when an access token request is performed.
func RefreshTokenHook ¶
func RefreshTokenHook(reg interface { config.Provider x.HTTPClientProvider }) AccessRequestHook
RefreshTokenHook is an AccessRequestHook called for `refresh_token` grant type.
func TokenHook ¶
func TokenHook(reg interface { config.Provider x.HTTPClientProvider }) AccessRequestHook
TokenHook is an AccessRequestHook called for all grant types.
type AssertionJWTReader ¶
type AssertionJWTReader interface { x.FositeStorer GetClientAssertionJWT(ctx context.Context, jti string) (*BlacklistedJTI, error) SetClientAssertionJWTRaw(context.Context, *BlacklistedJTI) error }
type BlacklistedJTI ¶
type BlacklistedJTI struct { JTI string `db:"-"` ID string `db:"signature"` Expiry time.Time `db:"expires_at"` NID gofrsuuid.UUID `db:"nid"` }
func NewBlacklistedJTI ¶
func NewBlacklistedJTI(jti string, exp time.Time) *BlacklistedJTI
func (*BlacklistedJTI) AfterFind ¶
func (j *BlacklistedJTI) AfterFind(_ *pop.Connection) error
func (BlacklistedJTI) TableName ¶
func (BlacklistedJTI) TableName() string
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(r InternalRegistry, c *config.DefaultProvider) *Handler
func (*Handler) DefaultErrorHandler ¶
func (h *Handler) DefaultErrorHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (*Handler) SetRoutes ¶
func (h *Handler) SetRoutes(admin *httprouterx.RouterAdmin, public *httprouterx.RouterPublic, corsMiddleware func(http.Handler) http.Handler)
type InternalRegistry ¶
type Introspection ¶
type Introspection struct { // Active is a boolean indicator of whether or not the presented token // is currently active. The specifics of a token's "active" state // will vary depending on the implementation of the authorization // server and the information it keeps about its tokens, but a "true" // value return for the "active" property will generally indicate // that a given token has been issued by this authorization server, // has not been revoked by the resource owner, and is within its // given time window of validity (e.g., after its issuance time and // before its expiration time). // // required: true Active bool `json:"active"` // Scope is a JSON string containing a space-separated list of // scopes associated with this token. Scope string `json:"scope,omitempty"` // ID is aclient identifier for the OAuth 2.0 client that // requested this token. ClientID string `json:"client_id"` // Subject of the token, as defined in JWT [RFC7519]. // Usually a machine-readable identifier of the resource owner who // authorized this token. Subject string `json:"sub"` // ObfuscatedSubject is set when the subject identifier algorithm was set to "pairwise" during authorization. // It is the `sub` value of the ID Token that was issued. ObfuscatedSubject string `json:"obfuscated_subject,omitempty"` // Expires at is an integer timestamp, measured in the number of seconds // since January 1 1970 UTC, indicating when this token will expire. ExpiresAt int64 `json:"exp"` // Issued at is an integer timestamp, measured in the number of seconds // since January 1 1970 UTC, indicating when this token was // originally issued. IssuedAt int64 `json:"iat"` // NotBefore is an integer timestamp, measured in the number of seconds // since January 1 1970 UTC, indicating when this token is not to be // used before. NotBefore int64 `json:"nbf"` // Username is a human-readable identifier for the resource owner who // authorized this token. Username string `json:"username,omitempty"` // Audience contains a list of the token's intended audiences. Audience []string `json:"aud"` // IssuerURL is a string representing the issuer of this token Issuer string `json:"iss"` // TokenType is the introspected token's type, typically `Bearer`. TokenType string `json:"token_type"` // TokenUse is the introspected token's use, for example `access_token` or `refresh_token`. TokenUse string `json:"token_use"` // Extra is arbitrary data set by the session. Extra map[string]interface{} `json:"ext,omitempty"` }
Introspection contains an access token's session data as specified by [IETF RFC 7662](https://tools.ietf.org/html/rfc7662)
swagger:model introspectedOAuth2Token
type RefreshTokenHookRequest ¶
type RefreshTokenHookRequest struct { // Subject is the identifier of the authenticated end-user. Subject string `json:"subject"` // Session is the request's session.. Session *Session `json:"session"` // Requester is a token endpoint's request context. Requester Requester `json:"requester"` // ClientID is the identifier of the OAuth 2.0 client. ClientID string `json:"client_id"` // GrantedScopes is the list of scopes granted to the OAuth 2.0 client. GrantedScopes []string `json:"granted_scopes"` // GrantedAudience is the list of audiences granted to the OAuth 2.0 client. GrantedAudience []string `json:"granted_audience"` }
RefreshTokenHookRequest is the request body sent to the refresh token hook.
swagger:ignore
type Registry ¶
type Registry interface { OAuth2Storage() x.FositeStorer OAuth2Provider() fosite.OAuth2Provider AudienceStrategy() fosite.AudienceMatchingStrategy AccessTokenJWTStrategy() jwk.JWTSigner OpenIDConnectRequestValidator() *openid.OpenIDConnectRequestValidator AccessRequestHooks() []AccessRequestHook OAuth2ProviderConfig() fosite.Configurator }
type Request ¶
type Request struct { // ClientID is the identifier of the OAuth 2.0 client. ClientID string `json:"client_id"` // GrantedScopes is the list of scopes granted to the OAuth 2.0 client. GrantedScopes []string `json:"granted_scopes"` // GrantedAudience is the list of audiences granted to the OAuth 2.0 client. GrantedAudience []string `json:"granted_audience"` // GrantTypes is the requests grant types. GrantTypes []string `json:"grant_types"` // Payload is the requests payload. Payload map[string][]string `json:"payload"` }
Request is a token endpoint's request context.
swagger:ignore
type Requester ¶
type Requester struct { // ClientID is the identifier of the OAuth 2.0 client. ClientID string `json:"client_id"` // GrantedScopes is the list of scopes granted to the OAuth 2.0 client. GrantedScopes []string `json:"granted_scopes"` // GrantedAudience is the list of audiences granted to the OAuth 2.0 client. GrantedAudience []string `json:"granted_audience"` // GrantTypes is the requests grant types. GrantTypes []string `json:"grant_types"` }
Requester is a token endpoint's request context.
swagger:ignore
type Session ¶
type Session struct { *openid.DefaultSession `json:"id_token"` Extra map[string]interface{} `json:"extra"` KID string `json:"kid"` ClientID string `json:"client_id"` ConsentChallenge string `json:"consent_challenge"` ExcludeNotBeforeClaim bool `json:"exclude_not_before_claim"` AllowedTopLevelClaims []string `json:"allowed_top_level_claims"` }
swagger:ignore
func NewSession ¶
func (*Session) GetJWTClaims ¶
func (s *Session) GetJWTClaims() jwt.JWTClaimsContainer
func (*Session) GetJWTHeader ¶
func (*Session) UnmarshalJSON ¶
type TokenHookRequest ¶
type TokenHookRequest struct { // Session is the request's session.. Session *Session `json:"session"` // Requester is a token endpoint's request context. Request Request `json:"request"` }
TokenHookRequest is the request body sent to the token hook.
swagger:ignore
type TokenHookResponse ¶
type TokenHookResponse struct { // Session is the session data returned by the hook. Session consent.AcceptOAuth2ConsentRequestSession `json:"session"` }
TokenHookResponse is the response body received from the token hook.
swagger:ignore