oidc

package
v1.54.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScopeProjectRolePrefix = "urn:zitadel:iam:org:project:role:"
	ClaimProjectRoles      = "urn:zitadel:iam:org:project:roles"
	ScopeUserMetaData      = "urn:zitadel:iam:user:metadata"
	ClaimUserMetaData      = ScopeUserMetaData
	ScopeResourceOwner     = "urn:zitadel:iam:user:resourceowner"
	ClaimResourceOwner     = ScopeResourceOwner + ":"
)

Variables

This section is empty.

Functions

func ACRValuesToBusiness

func ACRValuesToBusiness(values []string) []domain.LevelOfAssurance

func AMRFromMFAType

func AMRFromMFAType(mfaType domain.MFAType) string

func AuthRequestFromBusiness

func AuthRequestFromBusiness(authReq *domain.AuthRequest) (_ op.AuthRequest, err error)

func ClientFromBusiness

func ClientFromBusiness(app *model.ApplicationView, defaultLoginURL string, defaultAccessTokenLifetime, defaultIdTokenLifetime time.Duration, allowedScopes []string) (op.Client, error)

func CodeChallengeToBusiness

func CodeChallengeToBusiness(challenge string, method oidc.CodeChallengeMethod) *domain.OIDCCodeChallenge

func CodeChallengeToOIDC

func CodeChallengeToOIDC(challenge *domain.OIDCCodeChallenge) *oidc.CodeChallenge

func CreateAuthRequestToBusiness

func CreateAuthRequestToBusiness(ctx context.Context, authReq *oidc.AuthRequest, userAgentID, userID string) *domain.AuthRequest

func GetSelectedIDPIDFromScopes added in v1.36.0

func GetSelectedIDPIDFromScopes(scopes oidc.SpaceDelimitedArray) string

func HttpHeadersFromContext

func HttpHeadersFromContext(ctx context.Context) (userAgent, acceptLang string)

func IpFromContext

func IpFromContext(ctx context.Context) net.IP

func MaxAgeToBusiness added in v1.16.2

func MaxAgeToBusiness(maxAge *uint) *time.Duration

func NewProvider

func NewProvider(ctx context.Context, config OPHandlerConfig, command *command.Commands, query *query.Queries, repo repository.Repository, keyConfig *crypto.KeyConfig, localDevMode bool) op.OpenIDProvider

func ParseBrowserInfoFromContext

func ParseBrowserInfoFromContext(ctx context.Context) *domain.BrowserInfo

func PromptToBusiness

func PromptToBusiness(oidcPrompt []string) []domain.Prompt

func RefreshTokenRequestFromBusiness added in v1.8.0

func RefreshTokenRequestFromBusiness(tokenView *model.RefreshTokenView) op.RefreshTokenRequest

func ResponseTypeToBusiness

func ResponseTypeToBusiness(responseType oidc.ResponseType) domain.OIDCResponseType

func ResponseTypeToOIDC

func ResponseTypeToOIDC(responseType domain.OIDCResponseType) oidc.ResponseType

func UILocalesToBusiness

func UILocalesToBusiness(tags []language.Tag) []string

Types

type AuthRequest

type AuthRequest struct {
	*domain.AuthRequest
}

func (*AuthRequest) Done

func (a *AuthRequest) Done() bool

func (*AuthRequest) GetACR

func (a *AuthRequest) GetACR() string

func (*AuthRequest) GetAMR

func (a *AuthRequest) GetAMR() []string

func (*AuthRequest) GetAudience

func (a *AuthRequest) GetAudience() []string

func (*AuthRequest) GetAuthTime

func (a *AuthRequest) GetAuthTime() time.Time

func (*AuthRequest) GetClientID

func (a *AuthRequest) GetClientID() string

func (*AuthRequest) GetCodeChallenge

func (a *AuthRequest) GetCodeChallenge() *oidc.CodeChallenge

func (*AuthRequest) GetID

func (a *AuthRequest) GetID() string

func (*AuthRequest) GetNonce

func (a *AuthRequest) GetNonce() string

func (*AuthRequest) GetRedirectURI

func (a *AuthRequest) GetRedirectURI() string

func (*AuthRequest) GetResponseMode added in v1.53.0

func (a *AuthRequest) GetResponseMode() oidc.ResponseMode

func (*AuthRequest) GetResponseType

func (a *AuthRequest) GetResponseType() oidc.ResponseType

func (*AuthRequest) GetScopes

func (a *AuthRequest) GetScopes() []string

func (*AuthRequest) GetState

func (a *AuthRequest) GetState() string

func (*AuthRequest) GetSubject

func (a *AuthRequest) GetSubject() string

type Client

type Client struct {
	*model.ApplicationView
	// contains filtered or unexported fields
}

func (*Client) AccessTokenLifetime

func (c *Client) AccessTokenLifetime() time.Duration

func (*Client) AccessTokenType

func (c *Client) AccessTokenType() op.AccessTokenType

func (*Client) ApplicationType

func (c *Client) ApplicationType() op.ApplicationType

func (*Client) AuthMethod added in v0.70.0

func (c *Client) AuthMethod() oidc.AuthMethod

func (*Client) ClockSkew added in v0.106.0

func (c *Client) ClockSkew() time.Duration

func (*Client) DevMode added in v0.70.0

func (c *Client) DevMode() bool

func (*Client) GetID

func (c *Client) GetID() string

func (*Client) GrantTypes added in v1.9.1

func (c *Client) GrantTypes() []oidc.GrantType

func (*Client) IDTokenLifetime

func (c *Client) IDTokenLifetime() time.Duration

func (*Client) IDTokenUserinfoClaimsAssertion added in v0.106.0

func (c *Client) IDTokenUserinfoClaimsAssertion() bool

func (*Client) IsScopeAllowed added in v0.101.0

func (c *Client) IsScopeAllowed(scope string) bool

func (*Client) LoginURL

func (c *Client) LoginURL(id string) string

func (*Client) PostLogoutRedirectURIs

func (c *Client) PostLogoutRedirectURIs() []string

func (*Client) RedirectURIs

func (c *Client) RedirectURIs() []string

func (*Client) ResponseTypes added in v0.70.0

func (c *Client) ResponseTypes() []oidc.ResponseType

func (*Client) RestrictAdditionalAccessTokenScopes added in v0.101.0

func (c *Client) RestrictAdditionalAccessTokenScopes() func(scopes []string) []string

func (*Client) RestrictAdditionalIdTokenScopes added in v0.101.0

func (c *Client) RestrictAdditionalIdTokenScopes() func(scopes []string) []string

type Endpoint

type Endpoint struct {
	Path string
	URL  string
}

type EndpointConfig

type EndpointConfig struct {
	Auth          *Endpoint
	Token         *Endpoint
	Introspection *Endpoint
	Userinfo      *Endpoint
	Revocation    *Endpoint
	EndSession    *Endpoint
	Keys          *Endpoint
}

type OPHandlerConfig

type OPHandlerConfig struct {
	OPConfig              *op.Config
	StorageConfig         StorageConfig
	UserAgentCookieConfig *middleware.UserAgentCookieConfig
	Cache                 *middleware.CacheConfig
	Endpoints             *EndpointConfig
}

type OPStorage

type OPStorage struct {
	// contains filtered or unexported fields
}

func (*OPStorage) AuthRequestByCode

func (o *OPStorage) AuthRequestByCode(ctx context.Context, code string) (_ op.AuthRequest, err error)

func (*OPStorage) AuthRequestByID

func (o *OPStorage) AuthRequestByID(ctx context.Context, id string) (_ op.AuthRequest, err error)

func (*OPStorage) AuthorizeClientIDSecret

func (o *OPStorage) AuthorizeClientIDSecret(ctx context.Context, id string, secret string) (err error)

func (*OPStorage) CreateAccessAndRefreshTokens added in v1.8.0

func (o *OPStorage) CreateAccessAndRefreshTokens(ctx context.Context, req op.TokenRequest, refreshToken string) (_, _ string, _ time.Time, err error)

func (*OPStorage) CreateAccessToken added in v1.8.0

func (o *OPStorage) CreateAccessToken(ctx context.Context, req op.TokenRequest) (_ string, _ time.Time, err error)

func (*OPStorage) CreateAuthRequest

func (o *OPStorage) CreateAuthRequest(ctx context.Context, req *oidc.AuthRequest, userID string) (_ op.AuthRequest, err error)

func (*OPStorage) DeleteAuthRequest

func (o *OPStorage) DeleteAuthRequest(ctx context.Context, id string) (err error)

func (*OPStorage) GetClientByClientID

func (o *OPStorage) GetClientByClientID(ctx context.Context, id string) (_ op.Client, err error)

func (*OPStorage) GetKeyByIDAndIssuer added in v0.115.0

func (o *OPStorage) GetKeyByIDAndIssuer(ctx context.Context, keyID, issuer string) (_ *jose.JSONWebKey, err error)

func (*OPStorage) GetKeyByIDAndUserID added in v0.85.3

func (o *OPStorage) GetKeyByIDAndUserID(ctx context.Context, keyID, userID string) (_ *jose.JSONWebKey, err error)

func (*OPStorage) GetKeySet

func (o *OPStorage) GetKeySet(ctx context.Context) (_ *jose.JSONWebKeySet, err error)

func (*OPStorage) GetPrivateClaimsFromScopes added in v0.94.0

func (o *OPStorage) GetPrivateClaimsFromScopes(ctx context.Context, userID, clientID string, scopes []string) (claims map[string]interface{}, err error)

func (*OPStorage) GetSigningKey

func (o *OPStorage) GetSigningKey(ctx context.Context, keyCh chan<- jose.SigningKey)

func (*OPStorage) Health

func (o *OPStorage) Health(ctx context.Context) error

func (*OPStorage) RevokeToken added in v1.53.0

func (o *OPStorage) RevokeToken(ctx context.Context, token, userID, clientID string) *oidc.Error

func (*OPStorage) SaveAuthCode

func (o *OPStorage) SaveAuthCode(ctx context.Context, id, code string) (err error)

func (*OPStorage) SetIntrospectionFromToken added in v0.115.0

func (o *OPStorage) SetIntrospectionFromToken(ctx context.Context, introspection oidc.IntrospectionResponse, tokenID, subject, clientID string) error

func (*OPStorage) SetUserinfoFromScopes added in v0.115.0

func (o *OPStorage) SetUserinfoFromScopes(ctx context.Context, userInfo oidc.UserInfoSetter, userID, applicationID string, scopes []string) (err error)

func (*OPStorage) SetUserinfoFromToken added in v0.115.0

func (o *OPStorage) SetUserinfoFromToken(ctx context.Context, userInfo oidc.UserInfoSetter, tokenID, subject, origin string) (err error)

func (*OPStorage) TerminateSession

func (o *OPStorage) TerminateSession(ctx context.Context, userID, clientID string) (err error)

func (*OPStorage) TokenRequestByRefreshToken added in v1.8.0

func (o *OPStorage) TokenRequestByRefreshToken(ctx context.Context, refreshToken string) (op.RefreshTokenRequest, error)

func (*OPStorage) ValidateJWTProfileScopes added in v0.115.0

func (o *OPStorage) ValidateJWTProfileScopes(ctx context.Context, subject string, scopes []string) ([]string, error)

type RefreshTokenRequest added in v1.8.0

type RefreshTokenRequest struct {
	*model.RefreshTokenView
}

func (*RefreshTokenRequest) GetAMR added in v1.8.0

func (r *RefreshTokenRequest) GetAMR() []string

func (*RefreshTokenRequest) GetAudience added in v1.8.0

func (r *RefreshTokenRequest) GetAudience() []string

func (*RefreshTokenRequest) GetAuthTime added in v1.8.0

func (r *RefreshTokenRequest) GetAuthTime() time.Time

func (*RefreshTokenRequest) GetClientID added in v1.8.0

func (r *RefreshTokenRequest) GetClientID() string

func (*RefreshTokenRequest) GetScopes added in v1.8.0

func (r *RefreshTokenRequest) GetScopes() []string

func (*RefreshTokenRequest) GetSubject added in v1.8.0

func (r *RefreshTokenRequest) GetSubject() string

func (*RefreshTokenRequest) SetCurrentScopes added in v1.8.0

func (r *RefreshTokenRequest) SetCurrentScopes(scopes []string)

type StorageConfig

type StorageConfig struct {
	DefaultLoginURL                   string
	SigningKeyAlgorithm               string
	DefaultAccessTokenLifetime        types.Duration
	DefaultIdTokenLifetime            types.Duration
	DefaultRefreshTokenIdleExpiration types.Duration
	DefaultRefreshTokenExpiration     types.Duration
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL