Documentation
¶
Overview ¶
Package introspection provides structures and functions to implement the additional OAuth2 Token Introspection specification.
Index ¶
Constants ¶
const ( AccessToken = "access_token" RefreshToken = "refresh_token" )
The known OAuth2 token types.
Variables ¶
This section is empty.
Functions ¶
func KnownTokenType ¶
KnownTokenType returns true if the token type is a known token type (e.g. access token or refresh token).
func UnsupportedTokenType ¶
UnsupportedTokenType constructs an error that indicates that the authorization server does not support the introspection of the presented token type.
func WriteResponse ¶
func WriteResponse(w http.ResponseWriter, r *Response) error
WriteResponse will write a response to the response writer.
Types ¶
type Request ¶
type Request struct {
Token string
TokenTypeHint string
ClientID string
ClientSecret string
HTTP *http.Request
}
A Request is typically returned by ParseRequest and holds all information necessary to handle an introspection request.
type Response ¶
type Response struct {
Active bool `json:"active"`
Scope string `json:"scope,omitempty"`
ClientID string `json:"client_id,omitempty"`
Username string `json:"username,omitempty"`
TokenType string `json:"token_type,omitempty"`
ExpiresAt int64 `json:"exp,omitempty"`
IssuedAt int64 `json:"iat,omitempty"`
NotBefore int64 `json:"nbf,omitempty"`
Subject string `json:"sub,omitempty"`
Audience string `json:"aud,omitempty"`
Issuer string `json:"iss,omitempty"`
Identifier string `json:"jti,omitempty"`
Extra map[string]interface{} `json:"extra,omitempty"`
}
Response is a response returned by the token introspection endpoint.
func NewResponse ¶
NewResponse constructs a Response.