Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Introspect ¶
Introspect returns the token introspection response
func NewClientCredentialsClient ¶
func NewClientCredentialsClient(ctx context.Context, cfg ClientCredentialsConfig) *http.Client
NewClientCredentialsClient creates a new OAuth2 client that supports the client_credentials grant type
Types ¶
type Client ¶
type ClientCredentialsConfig ¶
type ClientCredentialsConfig struct { ClientID string ClientSecret string TokenURL string Scopes []string }
ClientCredentialsConfig represents the configuration for the client_credentials grant type
type ClientOption ¶
type ClientOption func(*client)
ClientOption is a function that configures a Client.
func SetClientAPIEndpoint ¶
func SetClientAPIEndpoint(endpoint string) ClientOption
SetClientAPIEndpoint sets the endpoint for the Client API.
func SetHTTPClient ¶
func SetHTTPClient(httpClient *http.Client) ClientOption
SetHTTPClient sets the HTTP client to use for requests.
func SetIntrospectEndpoint ¶
func SetIntrospectEndpoint(endpoint string) ClientOption
SetIntrospectEndpoint sets the endpoint for the Introspect API.
func SetUserAPIEndpoint ¶
func SetUserAPIEndpoint(endpoint string) ClientOption
SetUserAPIEndpoint sets the endpoint for the User API.
type ErrorResponse ¶
type ErrorResponse struct { Code int `json:"code"` Err string `json:"error"` Message string `json:"message,omitempty"` Details interface{} `json:"details,omitempty"` RequestID string `json:"request_id,omitempty"` }
ErrorResponse is a struct that contains an error message.
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
Error implements the error interface.
type TokenInfo ¶
type TokenInfo struct { Active bool `json:"active"` Scope string `json:"scope,omitempty"` ClientID string `json:"client_id,omitempty"` UserID string `json:"user_id,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"` TokenID string `json:"jti,omitempty"` }
TokenInfo is a struct that contains information about a token.