Documentation
¶
Index ¶
- Variables
- func MarshalOptNoRefresh(t *Token)
- type Claims
- type Client
- func (c *Client) Authenticate(ctx context.Context) (*Token, error)
- func (c *Client) Exchange(ctx context.Context, code string, codeVerifier string) (*oauth2.Token, error)
- func (c *Client) GetAuthCodeURL(oauthMaterial *oauthMaterial) string
- func (c *Client) RefreshToken(ctx context.Context, oldToken *Token) (*Token, error)
- func (c *Client) ValidateState(ourState []byte, otherState []byte) error
- func (c *Client) Verify(ctx context.Context, ourNonce []byte, rawIDToken string) (*oidc.IDToken, error)
- type Config
- type MarshalOpts
- type Option
- type ServerConfig
- type Token
Constants ¶
This section is empty.
Variables ¶
View Source
var SetOauth2AuthStyle = func(authStyle oauth2.AuthStyle) Option { return func(c *Client) { c.OauthConfig.Endpoint.AuthStyle = authStyle } }
View Source
var SetScopeOptions = func(scopes []string) Option { return func(c *Client) { c.OauthConfig.Scopes = scopes } }
View Source
var SetSuccessMessage = func(successMessage string) Option { return func(c *Client) { c.customMessages[oidcStatusSuccess] = successMessage } }
Functions ¶
Types ¶
type Claims ¶
type Claims struct { Issuer string `json:"iss"` Audience string `json:"aud"` Subject string `json:"sub"` Name string `json:"name"` AuthenticationMethods []string `json:"amr"` Email string `json:"email"` }
Claims represent the oidc token claims
type Client ¶
Client is an oauth client
func (*Client) Authenticate ¶
Authenticate will authenticate authenticate with the idp
func (*Client) Exchange ¶
func (c *Client) Exchange(ctx context.Context, code string, codeVerifier string) (*oauth2.Token, error)
Exchange will exchange a token
func (*Client) GetAuthCodeURL ¶
GetAuthCodeURL gets the url to the oauth2 consent page
func (*Client) RefreshToken ¶
RefreshToken will fetch a new token
func (*Client) ValidateState ¶
ValidateState validates the state from the authorize request
type Config ¶
type Config struct { ClientID string IssuerURL string ServerConfig *ServerConfig }
Config is required to config a client
type ServerConfig ¶
ServerConfig is a server config
func (*ServerConfig) Validate ¶
func (c *ServerConfig) Validate() error
Validate validates the config
type Token ¶
type Token struct { Version int Expiry time.Time `json:"expires,omitempty"` IDToken string `json:"token,omitempty"` AccessToken string `json:"access_token,omitempty"` RefreshToken string `json:"refresh_token,omitempty"` Claims Claims `json:"claims,omitempty"` }
Token wraps the extracted claims, auth token, id token, refresh token so we can easily use it throughout our application
func TokenFromString ¶
func TokenFromString(tokenString *string, opts ...MarshalOpts) (*Token, error)
Click to show internal directories.
Click to hide internal directories.