Documentation
¶
Index ¶
Constants ¶
const ( IsAccessTokenClaim = "kc.isAccessToken" AuthorizedScopesClaim = "kc.authorizedScopes" IsRefreshTokenClaim = "kc.isRefreshToken" RefClaim = "kc.ref" IdentityClaim = "kc.identity" )
Access token claims used by Konnect.
const ( IdentifiedUsernameClaim = "kc.i.un" IdentifiedDisplayNameClaim = "kc.i.dn" )
Identifier claims used by Konnect.
const ( // ScopeID is the string value for the Konnect ID scope. ScopeID = "konnect/id" // ScopeUniqueUserID is the string value for the Konnect Unique User ID scope. ScopeUniqueUserID = "konnect/uuid" )
Variables ¶
This section is empty.
Functions ¶
func FromClaimsContext ¶
FromClaimsContext returns the AuthRecord value stored in ctx, if any.
Types ¶
type AccessTokenClaims ¶
type AccessTokenClaims struct {
IsAccessToken bool `json:"kc.isAccessToken"`
AuthorizedScopesList []string `json:"kc.authorizedScopes"`
jwt.StandardClaims
IdentityClaims jwt.MapClaims `json:"kc.identity"`
}
AccessTokenClaims define the claims found in access tokens issued by Konnect.
func (AccessTokenClaims) AuthorizedScopes ¶
func (c AccessTokenClaims) AuthorizedScopes() map[string]bool
AuthorizedScopes returns a map with scope keys and true value of all scopes set in the accociated access token.
func (AccessTokenClaims) Valid ¶
func (c AccessTokenClaims) Valid() error
Valid implements the jwt.Claims interface.
type IDClaims ¶
type IDClaims struct {
// NOTE(longsleep): Always keep these claims compatible with the GitLab API
// https://docs.gitlab.com/ce/api/users.html#for-user.
KCID int64 `json:"id,omitempty"`
KCIDUsername string `json:"username,omitempty"`
}
IDClaims define the claims used with the konnect/id scope.
type RefreshTokenClaims ¶
type RefreshTokenClaims struct {
IsRefreshToken bool `json:"kc.isRefreshToken"`
ApprovedScopesList []string `json:"kc.approvedScopes"`
Ref string `json:"kc.ref"`
jwt.StandardClaims
IdentityClaims jwt.MapClaims `json:"kc.identity"`
}
RefreshTokenClaims define the claims used by refresh tokens.
func (RefreshTokenClaims) Valid ¶
func (c RefreshTokenClaims) Valid() error
Valid implements the jwt.Claims interface.
type UniqueUserIDClaims ¶
type UniqueUserIDClaims struct {
KCUniqueUserID string `json:"kc.uuid,omitempty"`
}
UniqueUserIDClaims define the claims used with the konnect/uuid scope.
func (UniqueUserIDClaims) Valid ¶
func (c UniqueUserIDClaims) Valid() error
Valid implements the jwt.Claims interface.
type UserInfoResponse ¶
type UserInfoResponse struct {
*payload.UserInfoResponse
*IDClaims
*UniqueUserIDClaims
}
UserInfoResponse defines the data returned from the Konnect UserInfo endpoint. It is the standard ODIC response, extended with additional claims.