Documentation
¶
Overview ¶
Package redis provides Authlier storage and optional session caching backed by Redis.
Index ¶
- Variables
- type AccessSessionStore
- func (store *AccessSessionStore) CreateSession(ctx context.Context, session authlier.AccessSession, ...) error
- func (store *AccessSessionStore) ListBySubject(ctx context.Context, subjectID string) ([]authlier.AccessSession, error)
- func (store *AccessSessionStore) ResolveSession(ctx context.Context, sessionID string) (accesstoken.Session, error)
- func (store *AccessSessionStore) Revoke(ctx context.Context, sessionID string, revokedAt time.Time) error
- func (store *AccessSessionStore) RevokeAll(ctx context.Context, subjectID string, revokedAt time.Time) error
- type Adapter
- func (adapter *Adapter) AccessSessions() *AccessSessionStore
- func (adapter *Adapter) EmailPassword() *EmailPasswordStore
- func (adapter *Adapter) EmailVerification() *EmailVerificationStore
- func (adapter *Adapter) Google() *GoogleStore
- func (adapter *Adapter) Migrate(ctx context.Context) error
- func (adapter *Adapter) OIDC() *OIDCStore
- func (adapter *Adapter) Passkeys() *PasskeyStore
- func (adapter *Adapter) PasswordReset() *PasswordResetStore
- func (adapter *Adapter) RefreshTokens() *RefreshTokenStore
- func (adapter *Adapter) SAML() *SAMLStore
- func (adapter *Adapter) Sessions() *SessionStore
- func (adapter *Adapter) Stores() authlier.Stores
- func (adapter *Adapter) TOTP() *TOTPStore
- type Config
- type EmailPasswordStore
- func (store *EmailPasswordStore) AddPassword(ctx context.Context, subjectID, passwordHash string, addedAt time.Time) (emailpassword.User, error)
- func (store *EmailPasswordStore) FindByEmail(ctx context.Context, email string) (emailpassword.User, emailpassword.PasswordCredential, error)
- func (store *EmailPasswordStore) FindBySubject(ctx context.Context, subjectID string) (emailpassword.User, emailpassword.PasswordCredential, error)
- func (store *EmailPasswordStore) Register(ctx context.Context, registration emailpassword.Registration) (emailpassword.User, error)
- func (store *EmailPasswordStore) RemovePassword(ctx context.Context, subjectID, currentHash string, _ time.Time) error
- func (store *EmailPasswordStore) ReplacePasswordHash(ctx context.Context, userID, currentHash, replacementHash string, ...) error
- type EmailVerificationStore
- func (store *EmailVerificationStore) FindUserByEmail(ctx context.Context, email string) (emailverification.User, error)
- func (store *EmailVerificationStore) Issue(ctx context.Context, record emailverification.Record) error
- func (store *EmailVerificationStore) Verify(ctx context.Context, tokenHash emailverification.TokenHash, ...) (emailverification.User, error)
- type GoogleStore
- func (store *GoogleStore) ConsumeChallenge(ctx context.Context, stateHash [32]byte, consumedAt time.Time) (googleoauth.Challenge, error)
- func (store *GoogleStore) CreateChallenge(ctx context.Context, challenge googleoauth.Challenge) error
- func (store *GoogleStore) ResolveIdentity(ctx context.Context, resolution googleoauth.IdentityResolution) (googleoauth.User, error)
- func (store *GoogleStore) UnlinkIdentity(ctx context.Context, subjectID string, _ time.Time) error
- type OIDCStore
- type PasskeyStore
- func (store *PasskeyStore) CompleteAuthentication(ctx context.Context, ceremonyHash passkey.CeremonyHash, subjectID string, ...) error
- func (store *PasskeyStore) CompleteRegistration(ctx context.Context, ceremonyHash passkey.CeremonyHash, subjectID string, ...) error
- func (store *PasskeyStore) CreateCeremony(ctx context.Context, ceremony passkey.Ceremony) error
- func (store *PasskeyStore) DeleteCredential(ctx context.Context, subjectID string, credentialID []byte, _ time.Time) error
- func (store *PasskeyStore) FindCeremony(ctx context.Context, ceremonyHash passkey.CeremonyHash) (passkey.Ceremony, error)
- func (store *PasskeyStore) FindUserByCredential(ctx context.Context, credentialID, userHandle []byte) (passkey.User, error)
- func (store *PasskeyStore) FindUserBySubject(ctx context.Context, subjectID string) (passkey.User, error)
- type PasswordResetStore
- func (store *PasswordResetStore) FindUserByEmail(ctx context.Context, email string) (passwordreset.User, error)
- func (store *PasswordResetStore) Issue(ctx context.Context, record passwordreset.Record) error
- func (store *PasswordResetStore) ResetPassword(ctx context.Context, tokenHash passwordreset.TokenHash, passwordHash string, ...) (passwordreset.User, error)
- type RefreshTokenStore
- func (store *RefreshTokenStore) Create(ctx context.Context, record refreshtoken.Record) error
- func (store *RefreshTokenStore) FindByTokenHash(ctx context.Context, tokenHash refreshtoken.TokenHash) (refreshtoken.Record, error)
- func (store *RefreshTokenStore) RevokeSession(ctx context.Context, sessionID string, revokedAt time.Time) error
- func (store *RefreshTokenStore) Rotate(ctx context.Context, current refreshtoken.TokenHash, ...) error
- type SAMLStore
- type SecretCodec
- type SessionCache
- func (cache *SessionCache) Delete(ctx context.Context, tokenHash sessiontoken.TokenHash) error
- func (cache *SessionCache) Get(ctx context.Context, tokenHash sessiontoken.TokenHash) (sessiontoken.Record, error)
- func (cache *SessionCache) Set(ctx context.Context, record sessiontoken.Record, ttl time.Duration) error
- type SessionStore
- func (store *SessionStore) Create(ctx context.Context, record sessiontoken.Record) error
- func (store *SessionStore) Extend(ctx context.Context, tokenHash sessiontoken.TokenHash, ...) (sessiontoken.Record, error)
- func (store *SessionStore) FindByTokenHash(ctx context.Context, tokenHash sessiontoken.TokenHash) (sessiontoken.Record, error)
- func (store *SessionStore) ListBySubject(ctx context.Context, subjectID string) ([]sessiontoken.Record, error)
- func (store *SessionStore) Revoke(ctx context.Context, tokenHash sessiontoken.TokenHash, revokedAt time.Time) error
- func (store *SessionStore) RevokeAll(ctx context.Context, subjectID string, revokedAt time.Time) ([]sessiontoken.Record, error)
- func (store *SessionStore) Rotate(ctx context.Context, current sessiontoken.TokenHash, ...) error
- type TOTPStore
- func (store *TOTPStore) BeginEnrollment(ctx context.Context, enrollment totp.Enrollment) error
- func (store *TOTPStore) CompleteCode(ctx context.Context, challengeHash totp.ChallengeHash, counter uint64, ...) (string, error)
- func (store *TOTPStore) CompleteRecovery(ctx context.Context, challengeHash totp.ChallengeHash, ...) (string, error)
- func (store *TOTPStore) CreateChallenge(ctx context.Context, challenge totp.Challenge) error
- func (store *TOTPStore) Disable(ctx context.Context, subjectID string, disabledAt time.Time) error
- func (store *TOTPStore) Enable(ctx context.Context, subjectID string, confirmedCounter uint64, ...) error
- func (store *TOTPStore) FindChallenge(ctx context.Context, challengeHash totp.ChallengeHash) (totp.Challenge, totp.Credential, error)
- func (store *TOTPStore) FindEnrollment(ctx context.Context, subjectID string) (totp.Enrollment, error)
- func (store *TOTPStore) IsEnabled(ctx context.Context, subjectID string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidConfig = errors.New("invalid Redis adapter configuration")
View Source
var ErrTransactionConflict = errors.New("Redis transaction could not be completed")
Functions ¶
This section is empty.
Types ¶
type AccessSessionStore ¶
type AccessSessionStore struct {
// contains filtered or unexported fields
}
func (*AccessSessionStore) CreateSession ¶
func (store *AccessSessionStore) CreateSession( ctx context.Context, session authlier.AccessSession, refreshToken refreshtoken.Record, ) error
func (*AccessSessionStore) ListBySubject ¶
func (store *AccessSessionStore) ListBySubject( ctx context.Context, subjectID string, ) ([]authlier.AccessSession, error)
func (*AccessSessionStore) ResolveSession ¶
func (store *AccessSessionStore) ResolveSession(ctx context.Context, sessionID string) (accesstoken.Session, error)
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
func New ¶
func New(client redislibrary.UniversalClient, config Config) (*Adapter, error)
func (*Adapter) AccessSessions ¶
func (adapter *Adapter) AccessSessions() *AccessSessionStore
func (*Adapter) EmailPassword ¶
func (adapter *Adapter) EmailPassword() *EmailPasswordStore
func (*Adapter) EmailVerification ¶
func (adapter *Adapter) EmailVerification() *EmailVerificationStore
func (*Adapter) Google ¶
func (adapter *Adapter) Google() *GoogleStore
func (*Adapter) Passkeys ¶
func (adapter *Adapter) Passkeys() *PasskeyStore
func (*Adapter) PasswordReset ¶
func (adapter *Adapter) PasswordReset() *PasswordResetStore
func (*Adapter) RefreshTokens ¶
func (adapter *Adapter) RefreshTokens() *RefreshTokenStore
func (*Adapter) Sessions ¶
func (adapter *Adapter) Sessions() *SessionStore
type Config ¶
type Config struct {
KeyPrefix string
Secrets SecretCodec
}
type EmailPasswordStore ¶
type EmailPasswordStore struct {
// contains filtered or unexported fields
}
func (*EmailPasswordStore) AddPassword ¶
func (store *EmailPasswordStore) AddPassword(ctx context.Context, subjectID, passwordHash string, addedAt time.Time) (emailpassword.User, error)
func (*EmailPasswordStore) FindByEmail ¶
func (store *EmailPasswordStore) FindByEmail(ctx context.Context, email string) (emailpassword.User, emailpassword.PasswordCredential, error)
func (*EmailPasswordStore) FindBySubject ¶
func (store *EmailPasswordStore) FindBySubject(ctx context.Context, subjectID string) (emailpassword.User, emailpassword.PasswordCredential, error)
func (*EmailPasswordStore) Register ¶
func (store *EmailPasswordStore) Register(ctx context.Context, registration emailpassword.Registration) (emailpassword.User, error)
func (*EmailPasswordStore) RemovePassword ¶
func (*EmailPasswordStore) ReplacePasswordHash ¶
type EmailVerificationStore ¶
type EmailVerificationStore struct {
// contains filtered or unexported fields
}
func (*EmailVerificationStore) FindUserByEmail ¶
func (store *EmailVerificationStore) FindUserByEmail(ctx context.Context, email string) (emailverification.User, error)
func (*EmailVerificationStore) Issue ¶
func (store *EmailVerificationStore) Issue(ctx context.Context, record emailverification.Record) error
func (*EmailVerificationStore) Verify ¶
func (store *EmailVerificationStore) Verify(ctx context.Context, tokenHash emailverification.TokenHash, verifiedAt time.Time) (emailverification.User, error)
type GoogleStore ¶
type GoogleStore struct {
// contains filtered or unexported fields
}
func (*GoogleStore) ConsumeChallenge ¶
func (store *GoogleStore) ConsumeChallenge(ctx context.Context, stateHash [32]byte, consumedAt time.Time) (googleoauth.Challenge, error)
func (*GoogleStore) CreateChallenge ¶
func (store *GoogleStore) CreateChallenge(ctx context.Context, challenge googleoauth.Challenge) error
func (*GoogleStore) ResolveIdentity ¶
func (store *GoogleStore) ResolveIdentity(ctx context.Context, resolution googleoauth.IdentityResolution) (googleoauth.User, error)
func (*GoogleStore) UnlinkIdentity ¶
type OIDCStore ¶
type OIDCStore struct {
// contains filtered or unexported fields
}
func (*OIDCStore) ConsumeChallenge ¶
type PasskeyStore ¶
type PasskeyStore struct {
// contains filtered or unexported fields
}
func (*PasskeyStore) CompleteAuthentication ¶
func (store *PasskeyStore) CompleteAuthentication(ctx context.Context, ceremonyHash passkey.CeremonyHash, subjectID string, previous, updated passkey.Credential, completedAt time.Time) error
func (*PasskeyStore) CompleteRegistration ¶
func (store *PasskeyStore) CompleteRegistration(ctx context.Context, ceremonyHash passkey.CeremonyHash, subjectID string, credential passkey.Credential, completedAt time.Time) error
func (*PasskeyStore) CreateCeremony ¶
func (*PasskeyStore) DeleteCredential ¶
func (*PasskeyStore) FindCeremony ¶
func (store *PasskeyStore) FindCeremony(ctx context.Context, ceremonyHash passkey.CeremonyHash) (passkey.Ceremony, error)
func (*PasskeyStore) FindUserByCredential ¶
func (*PasskeyStore) FindUserBySubject ¶
type PasswordResetStore ¶
type PasswordResetStore struct {
// contains filtered or unexported fields
}
func (*PasswordResetStore) FindUserByEmail ¶
func (store *PasswordResetStore) FindUserByEmail(ctx context.Context, email string) (passwordreset.User, error)
func (*PasswordResetStore) Issue ¶
func (store *PasswordResetStore) Issue(ctx context.Context, record passwordreset.Record) error
func (*PasswordResetStore) ResetPassword ¶
func (store *PasswordResetStore) ResetPassword(ctx context.Context, tokenHash passwordreset.TokenHash, passwordHash string, resetAt time.Time) (passwordreset.User, error)
type RefreshTokenStore ¶
type RefreshTokenStore struct {
// contains filtered or unexported fields
}
func (*RefreshTokenStore) Create ¶
func (store *RefreshTokenStore) Create(ctx context.Context, record refreshtoken.Record) error
func (*RefreshTokenStore) FindByTokenHash ¶
func (store *RefreshTokenStore) FindByTokenHash(ctx context.Context, tokenHash refreshtoken.TokenHash) (refreshtoken.Record, error)
func (*RefreshTokenStore) RevokeSession ¶
func (*RefreshTokenStore) Rotate ¶
func (store *RefreshTokenStore) Rotate(ctx context.Context, current refreshtoken.TokenHash, replacement refreshtoken.Record, rotatedAt time.Time) error
type SAMLStore ¶
type SAMLStore struct {
// contains filtered or unexported fields
}
func (*SAMLStore) ConsumeRequest ¶
type SecretCodec ¶
type SessionCache ¶
type SessionCache struct {
// contains filtered or unexported fields
}
func NewSessionCache ¶
func NewSessionCache( client redislibrary.UniversalClient, keyPrefix string, ) (*SessionCache, error)
func (*SessionCache) Delete ¶
func (cache *SessionCache) Delete( ctx context.Context, tokenHash sessiontoken.TokenHash, ) error
func (*SessionCache) Get ¶
func (cache *SessionCache) Get( ctx context.Context, tokenHash sessiontoken.TokenHash, ) (sessiontoken.Record, error)
func (*SessionCache) Set ¶
func (cache *SessionCache) Set( ctx context.Context, record sessiontoken.Record, ttl time.Duration, ) error
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
func (*SessionStore) Create ¶
func (store *SessionStore) Create(ctx context.Context, record sessiontoken.Record) error
func (*SessionStore) Extend ¶
func (store *SessionStore) Extend(ctx context.Context, tokenHash sessiontoken.TokenHash, extendedAt, expiresAt time.Time) (sessiontoken.Record, error)
func (*SessionStore) FindByTokenHash ¶
func (store *SessionStore) FindByTokenHash(ctx context.Context, tokenHash sessiontoken.TokenHash) (sessiontoken.Record, error)
func (*SessionStore) ListBySubject ¶
func (store *SessionStore) ListBySubject(ctx context.Context, subjectID string) ([]sessiontoken.Record, error)
func (*SessionStore) Revoke ¶
func (store *SessionStore) Revoke(ctx context.Context, tokenHash sessiontoken.TokenHash, revokedAt time.Time) error
func (*SessionStore) RevokeAll ¶
func (store *SessionStore) RevokeAll(ctx context.Context, subjectID string, revokedAt time.Time) ([]sessiontoken.Record, error)
func (*SessionStore) Rotate ¶
func (store *SessionStore) Rotate(ctx context.Context, current sessiontoken.TokenHash, replacement sessiontoken.Record, rotatedAt time.Time) error
type TOTPStore ¶
type TOTPStore struct {
// contains filtered or unexported fields
}
func (*TOTPStore) BeginEnrollment ¶
func (*TOTPStore) CompleteCode ¶
func (*TOTPStore) CompleteRecovery ¶
func (*TOTPStore) CreateChallenge ¶
func (*TOTPStore) FindChallenge ¶
func (store *TOTPStore) FindChallenge(ctx context.Context, challengeHash totp.ChallengeHash) (totp.Challenge, totp.Credential, error)
func (*TOTPStore) FindEnrollment ¶
Click to show internal directories.
Click to hide internal directories.