Documentation
¶
Index ¶
- type AuthorizationCodeFlow
- type Client
- func (c Client) ExchangeAuthCode(ctx context.Context, code string, redirectUri xurl.URL, verifier string) (resp Token, err error)
- func (c Client) NewAuthorizationCode(redirectURI xurl.URL) AuthorizationCodeFlow
- func (c Client) Refresh(ctx context.Context, refreshToken string, scopes scope.Scopes) (resp Token, err error)
- func (c Client) RevokeRefreshToken(ctx context.Context, refreshToken string) error
- type ClientConfig
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthorizationCodeFlow ¶
type AuthorizationCodeFlow struct {
Client
RedirectURI xurl.URL
// contains filtered or unexported fields
}
func (AuthorizationCodeFlow) BrowserUrl ¶
BrowserUrl asks for the standard scopes plus extraScopes. askConsent makes keycloak show its consent screen even for scopes the user has granted before.
func (AuthorizationCodeFlow) CheckState ¶
func (a AuthorizationCodeFlow) CheckState(state string) error
type Client ¶
type Client struct {
http.Client
ClientConfig
Id string
}
func (Client) ExchangeAuthCode ¶
func (c Client) ExchangeAuthCode(ctx context.Context, code string, redirectUri xurl.URL, verifier string) (resp Token, err error)
ExchangeAuthCode ends the authorization code flow, see AuthorizationCodeFlow.Exchange.
func (Client) NewAuthorizationCode ¶
func (c Client) NewAuthorizationCode(redirectURI xurl.URL) AuthorizationCodeFlow
func (Client) RevokeRefreshToken ¶ added in v0.7.0
RevokeRefreshToken ends the session of a login (RFC 7009). For keycloak's offline token that is the offline session of this client alone, while its end_session_endpoint would sign the browser out of every client.
type ClientConfig ¶
type ClientConfig struct {
Issuer xurl.URL `json:"issuer"`
AuthorizationEndpoint xurl.URL `json:"authorization_endpoint"`
TokenEndpoint xurl.URL `json:"token_endpoint"`
// RevocationEndpoint is optional in the discovery document (RFC 8414).
RevocationEndpoint *xurl.URL `json:"revocation_endpoint"`
}
type Token ¶
type Token struct {
AccessToken jwt.JWT `json:"access_token"`
RefreshToken string `json:"refresh_token"`
Scope string `json:"scope"`
// RefreshExpiresIn is Keycloak's own field: the seconds left until the refresh token's session
// ends at the latest, where 0 or its absence means no limit.
RefreshExpiresIn int64 `json:"refresh_expires_in"`
// RefreshExpiresAt counts from before the request was sent, so it errs early.
RefreshExpiresAt time.Time `json:"-"`
}
Click to show internal directories.
Click to hide internal directories.