Documentation ¶
Overview ¶
Package lico is a Go implementation of an OpenID Connect server with flexibale authorization and authentication backends and consent screen.
See README.md for more info.
Index ¶
Constants ¶
const ( IsAccessTokenClaim = "kc.isAccessToken" AuthorizedScopesClaim = "kc.authorizedScopes" IsRefreshTokenClaim = "kc.isRefreshToken" RefClaim = "kc.ref" IdentityClaim = "kc.identity" IdentityProvider = "kc.provider" )
Access token claims used by Konnect.
const ( IdentifiedUserClaim = "kc.i.us" IdentifiedUserIDClaim = "kc.i.id" IdentifiedUsernameClaim = "kc.i.un" IdentifiedDisplayNameClaim = "kc.i.dn" IdentifiedData = "kc.i.da" IdentifiedUserIsGuest = "kc.i.guest" )
Identifier identity sub 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" // ScopeRawSubject is the string value for the Konnect Raw Subject scope. ScopeRawSubject = "konnect/raw_sub" // ScopeGuestOK is the string value for the Konnect Guest OK scope. ScopeGuestOK = "konnect/guestok" )
Variables ¶
This section is empty.
Functions ¶
func FromClaimsContext ¶
FromClaimsContext returns the AuthRecord value stored in ctx, if any.
Types ¶
type AccessTokenClaims ¶
type AccessTokenClaims struct { jwt.StandardClaims IsAccessToken bool `json:"kc.isAccessToken"` AuthorizedScopesList []string `json:"kc.authorizedScopes"` AuthorizedClaimsRequest *payload.ClaimsRequest `json:"kc.authorizedClaims,omitempty"` IdentityClaims jwt.MapClaims `json:"kc.identity"` IdentityProvider string `json:"kc.provider,omitempty"` }
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 AccessTokenProvider ¶
type AccessTokenProvider interface {
MakeAccessToken(ctx context.Context, audience string, auth identity.AuthRecord) (string, error)
}
AccessTokenProvider is an interface for something which can create access tokens.
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 { jwt.StandardClaims IsRefreshToken bool `json:"kc.isRefreshToken"` ApprovedScopesList []string `json:"kc.approvedScopes"` ApprovedClaimsRequest *payload.ClaimsRequest `json:"kc.approvedClaims,omitempty"` Ref string `json:"kc.ref"` IdentityClaims jwt.MapClaims `json:"kc.identity"` IdentityProvider string `json:"kc.provider,omitempty"` }
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.