Documentation
¶
Index ¶
- Constants
- Variables
- func NewProvider(logger *slog.Logger, options ProviderOptions) (*op.Provider, error)
- type Client
- func (c *Client) AccessTokenType() op.AccessTokenType
- func (c *Client) ApplicationType() op.ApplicationType
- func (c *Client) AuthMethod() oidc.AuthMethod
- func (c *Client) ClockSkew() time.Duration
- func (c *Client) DevMode() bool
- func (c *Client) GetID() string
- func (c *Client) GrantTypes() []oidc.GrantType
- func (c *Client) IDTokenLifetime() time.Duration
- func (c *Client) IDTokenUserinfoClaimsAssertion() bool
- func (c *Client) IsScopeAllowed(scope string) bool
- func (c *Client) LoginURL(id string) string
- func (c *Client) PostLogoutRedirectURIs() []string
- func (c *Client) RedirectURIs() []string
- func (c *Client) ResponseTypes() []oidc.ResponseType
- func (c *Client) RestrictAdditionalAccessTokenScopes() func(scopes []string) []string
- func (c *Client) RestrictAdditionalIdTokenScopes() func(scopes []string) []string
- type CreateRefreshTokenArgs
- type CreateTokenArgs
- type ExchangeRefreshTokenArgs
- type IssueTokensArgs
- type ProviderOptions
- type Server
- type Storage
- func (s *Storage) AuthRequestByCode(ctx context.Context, code string) (op.AuthRequest, error)
- func (s *Storage) AuthRequestByID(ctx context.Context, id string) (op.AuthRequest, error)
- func (s *Storage) AuthorizeClientIDSecret(ctx context.Context, clientID string, clientSecret string) error
- func (s *Storage) CreateAccessAndRefreshTokens(ctx context.Context, request op.TokenRequest, currentRefreshToken string) (accessTokenID string, newRefreshTokenID string, expiration time.Time, ...)
- func (s *Storage) CreateAccessToken(ctx context.Context, request op.TokenRequest) (accessTokenID string, expiration time.Time, err error)
- func (s *Storage) CreateAuthRequest(ctx context.Context, authReq *oidc.AuthRequest, userID string) (op.AuthRequest, error)
- func (s *Storage) DeleteAuthRequest(ctx context.Context, id string) error
- func (s *Storage) GetClientByClientID(ctx context.Context, clientID string) (op.Client, error)
- func (s *Storage) GetKeyByIDAndClientID(ctx context.Context, keyID string, clientID string) (*jose.JSONWebKey, error)
- func (s *Storage) GetPrivateClaimsFromScopes(ctx context.Context, userID string, clientID string, scopes []string) (map[string]any, error)
- func (s *Storage) GetRefreshTokenInfo(ctx context.Context, clientID string, token string) (userID string, tokenID string, err error)
- func (s *Storage) Health(context.Context) error
- func (s *Storage) KeySet(ctx context.Context) ([]op.Key, error)
- func (s *Storage) RevokeToken(ctx context.Context, tokenOrTokenID string, userID string, clientID string) *oidc.Error
- func (s *Storage) SaveAuthCode(ctx context.Context, id string, code string) error
- func (s *Storage) SetIntrospectionFromToken(ctx context.Context, introspection *oidc.IntrospectionResponse, tokenID string, ...) error
- func (s *Storage) SetUserinfoFromRequest(ctx context.Context, userinfo *oidc.UserInfo, token op.IDTokenRequest, ...) error
- func (s *Storage) SetUserinfoFromScopes(ctx context.Context, userinfo *oidc.UserInfo, userID string, clientID string, ...) error
- func (s *Storage) SetUserinfoFromToken(ctx context.Context, userinfo *oidc.UserInfo, tokenID string, subject string, ...) error
- func (s *Storage) SignatureAlgorithms(ctx context.Context) ([]jose.SignatureAlgorithm, error)
- func (s *Storage) SigningKey(ctx context.Context) (op.SigningKey, error)
- func (s *Storage) TerminateSession(ctx context.Context, userID string, clientID string) error
- func (s *Storage) TokenRequestByRefreshToken(ctx context.Context, refreshTokenID string) (op.RefreshTokenRequest, error)
- func (s *Storage) ValidateJWTProfileScopes(ctx context.Context, userID string, scopes []string) ([]string, error)
Constants ¶
const (
KeyUseSig = "sig"
)
Variables ¶
var ( ErrUnsupportedKeyUse = errors.New("unsupported key use") ErrContainsInvalidCharacters = errors.New("invalid characters found, expecting letters, numbers, - or _") )
Functions ¶
func NewProvider ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(config configuration.ClientConfig) *Client
func (*Client) AccessTokenType ¶
func (c *Client) AccessTokenType() op.AccessTokenType
AccessTokenType implements op.Client.
func (*Client) ApplicationType ¶
func (c *Client) ApplicationType() op.ApplicationType
ApplicationType implements op.Client.
func (*Client) AuthMethod ¶
func (c *Client) AuthMethod() oidc.AuthMethod
AuthMethod implements op.Client.
func (*Client) GrantTypes ¶
GrantTypes implements op.Client.
func (*Client) IDTokenLifetime ¶
IDTokenLifetime implements op.Client.
func (*Client) IDTokenUserinfoClaimsAssertion ¶
IDTokenUserinfoClaimsAssertion implements op.Client.
func (*Client) IsScopeAllowed ¶
IsScopeAllowed implements op.Client.
func (*Client) PostLogoutRedirectURIs ¶
PostLogoutRedirectURIs implements op.Client.
func (*Client) RedirectURIs ¶
RedirectURIs implements op.Client.
func (*Client) ResponseTypes ¶
func (c *Client) ResponseTypes() []oidc.ResponseType
ResponseTypes implements op.Client.
func (*Client) RestrictAdditionalAccessTokenScopes ¶
RestrictAdditionalAccessTokenScopes implements op.Client.
func (*Client) RestrictAdditionalIdTokenScopes ¶
RestrictAdditionalIdTokenScopes implements op.Client.
type CreateRefreshTokenArgs ¶ added in v0.1.2
type CreateTokenArgs ¶ added in v0.1.2
type ExchangeRefreshTokenArgs ¶ added in v0.1.2
type ExchangeRefreshTokenArgs struct {
TokenRequest op.TokenExchangeRequest
}
type IssueTokensArgs ¶ added in v0.1.2
type IssueTokensArgs struct {
TokenRequest op.TokenRequest
IssueRefreshToken bool
}
type ProviderOptions ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(logger *slog.Logger, config *configuration.ConfigurationManager, db *sql.DB) (*Server, error)
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func NewStorage ¶
func NewStorage(logger *slog.Logger, configMgr *configuration.ConfigurationManager, db *sql.DB, queries *query.Queries, users *users, clients *clients) (*Storage, error)
func (*Storage) AuthRequestByCode ¶
func (*Storage) AuthRequestByID ¶
func (*Storage) AuthorizeClientIDSecret ¶
func (*Storage) CreateAccessAndRefreshTokens ¶
func (*Storage) CreateAccessToken ¶
func (s *Storage) CreateAccessToken(ctx context.Context, request op.TokenRequest) (accessTokenID string, expiration time.Time, err error)
CreateAccessToken implements op.Storage.
func (*Storage) CreateAuthRequest ¶
func (s *Storage) CreateAuthRequest(ctx context.Context, authReq *oidc.AuthRequest, userID string) (op.AuthRequest, error)
CreateAuthRequest implements op.Storage.
func (*Storage) DeleteAuthRequest ¶
DeleteAuthRequest implements op.Storage.
func (*Storage) GetClientByClientID ¶
GetClientByClientID implements op.Storage.
func (*Storage) GetKeyByIDAndClientID ¶
func (s *Storage) GetKeyByIDAndClientID(ctx context.Context, keyID string, clientID string) (*jose.JSONWebKey, error)
GetKeyByIDAndClientID implements op.Storage.
Clients have no registered public keys in the configuration, so a JWT assertion (private_key_jwt client authentication) cannot be verified.
func (*Storage) GetPrivateClaimsFromScopes ¶
func (s *Storage) GetPrivateClaimsFromScopes(ctx context.Context, userID string, clientID string, scopes []string) (map[string]any, error)
GetPrivateClaimsFromScopes implements op.Storage.
These are the claims of JWT access tokens beyond the registered ones; the library has already removed the profile, email, phone and address scopes, so only custom claims are added.
func (*Storage) GetRefreshTokenInfo ¶
func (s *Storage) GetRefreshTokenInfo(ctx context.Context, clientID string, token string) (userID string, tokenID string, err error)
GetRefreshTokenInfo implements op.Storage.
Refresh tokens are handed out as their ID.
func (*Storage) RevokeToken ¶
func (s *Storage) RevokeToken(ctx context.Context, tokenOrTokenID string, userID string, clientID string) *oidc.Error
RevokeToken implements op.Storage.
tokenOrTokenID is an access token ID or a refresh token ID. Revoking a refresh token also revokes the access tokens issued with it. A token that does not exist is already revoked (RFC 7009 section 2.2).
func (*Storage) SaveAuthCode ¶
SaveAuthCode implements op.Storage.
func (*Storage) SetIntrospectionFromToken ¶
func (s *Storage) SetIntrospectionFromToken(ctx context.Context, introspection *oidc.IntrospectionResponse, tokenID string, subject string, clientID string) error
SetIntrospectionFromToken implements op.Storage.
An error makes the token inactive. clientID is the resource server that asks: it must be in the token's audience.
func (*Storage) SetUserinfoFromRequest ¶
func (*Storage) SetUserinfoFromScopes ¶
func (*Storage) SetUserinfoFromToken ¶
func (s *Storage) SetUserinfoFromToken(ctx context.Context, userinfo *oidc.UserInfo, tokenID string, subject string, origin string) error
SetUserinfoFromToken implements op.Storage.
func (*Storage) SignatureAlgorithms ¶
SignatureAlgorithms implements op.Storage.
func (*Storage) SigningKey ¶
SigningKey implements op.Storage.
func (*Storage) TerminateSession ¶
TerminateSession implements op.Storage.
idpzero keeps no browser session: every authorization request shows the login page. There is nothing to terminate, so RP-initiated logout only redirects.
func (*Storage) TokenRequestByRefreshToken ¶
func (s *Storage) TokenRequestByRefreshToken(ctx context.Context, refreshTokenID string) (op.RefreshTokenRequest, error)
TokenRequestByRefreshToken implements op.Storage.