Documentation
¶
Overview ¶
Package authlier provides configurable authentication for Go applications.
Index ¶
- Variables
- type AccessSession
- type AccessSessionStore
- type Auth
- type BearerSessionConfig
- type Config
- type CookieConfig
- type Database
- type EmailAndPasswordConfig
- type EmailPasswordStore
- type EmailVerificationConfig
- type GoogleConfig
- type GoogleStore
- type OIDCConfig
- type OIDCIdentityResolver
- type PasskeyConfig
- type PasswordResetConfig
- type SAMLConfig
- type SAMLIdentityResolver
- type Session
- type SessionConfig
- type SessionMode
- type Stores
- type TOTPConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidConfig = errors.New("invalid Authlier configuration")
Functions ¶
This section is empty.
Types ¶
type AccessSession ¶
type AccessSessionStore ¶
type AccessSessionStore interface {
accesstoken.SessionResolver
CreateSession(ctx context.Context, session AccessSession, refreshToken refreshtoken.Record) error
ListBySubject(ctx context.Context, subjectID string) ([]AccessSession, error)
Revoke(ctx context.Context, sessionID string, revokedAt time.Time) error
RevokeAll(ctx context.Context, subjectID string, revokedAt time.Time) error
}
type BearerSessionConfig ¶
type Config ¶
type Config struct {
AppName string
BaseURL string
BasePath string
Database Database
TrustedOrigins []string
TrustedProxies []string
EmailAndPassword EmailAndPasswordConfig
EmailVerification EmailVerificationConfig
PasswordReset PasswordResetConfig
Session SessionConfig
TOTP TOTPConfig
Passkeys PasskeyConfig
Google GoogleConfig
OIDC OIDCConfig
SAML SAMLConfig
}
type CookieConfig ¶
type EmailAndPasswordConfig ¶
type EmailAndPasswordConfig struct {
Enabled bool
RequireEmailVerification bool
ValidatePassword emailpassword.PasswordValidator
AttemptGuard emailpassword.AttemptGuard
SecurityEvents emailpassword.SecurityEventSink
}
type EmailPasswordStore ¶
type EmailPasswordStore interface {
emailpassword.Store
emailpassword.CredentialStore
}
type EmailVerificationConfig ¶
type EmailVerificationConfig struct {
Enabled bool
Lifetime time.Duration
VerificationURL string
Sender emailverification.Sender
SendOnSignUp bool
SendOnSignIn bool
AutoSignInAfterVerification bool
AttemptGuard emailverification.AttemptGuard
SecurityEvents emailverification.SecurityEventSink
}
type GoogleConfig ¶
type GoogleConfig struct {
Enabled bool
ClientID string
ClientSecret string
RedirectURL string
SuccessRedirectURL string
StateLifetime time.Duration
HTTPClient *http.Client
Provider googleoauth.Provider
SecurityEvents googleoauth.SecurityEventSink
}
type GoogleStore ¶
type GoogleStore interface {
googleoauth.Store
googleoauth.IdentityStore
}
type OIDCConfig ¶
type OIDCConfig struct {
Enabled bool
Connections oidc.ConnectionSource
ResolveIdentity OIDCIdentityResolver
StateLifetime time.Duration
HTTPClient *http.Client
SuccessRedirectURL string
AttemptGuard oidc.AttemptGuard
SecurityEvents oidc.SecurityEventSink
}
type OIDCIdentityResolver ¶
type PasskeyConfig ¶
type PasskeyConfig struct {
Enabled bool
RelyingPartyID string
RelyingPartyName string
Origins []string
CeremonyLifetime time.Duration
AttemptGuard passkey.AttemptGuard
SecurityEvents passkey.SecurityEventSink
}
type PasswordResetConfig ¶
type PasswordResetConfig struct {
Enabled bool
Lifetime time.Duration
ResetURL string
Sender passwordreset.Sender
KeepSessionsAfterReset bool
AttemptGuard passwordreset.AttemptGuard
SecurityEvents passwordreset.SecurityEventSink
}
type SAMLConfig ¶
type SAMLConfig struct {
Enabled bool
Connections saml.ConnectionSource
ResolveIdentity SAMLIdentityResolver
RequestLifetime time.Duration
SuccessRedirectURL string
AttemptGuard saml.AttemptGuard
SecurityEvents saml.SecurityEventSink
}
type SAMLIdentityResolver ¶
type SessionConfig ¶
type SessionConfig struct {
Mode SessionMode
Lifetime time.Duration
FreshAge time.Duration
Cache sessiontoken.Cache
CacheTTL time.Duration
Extension *sessiontoken.ExtensionConfig
Cookie CookieConfig
Bearer BearerSessionConfig
}
type SessionMode ¶
type SessionMode string
const ( SessionModeCookie SessionMode = "cookie" SessionModeBearer SessionMode = "bearer" )
type Stores ¶
type Stores struct {
EmailPassword EmailPasswordStore
EmailVerification emailverification.Store
Google GoogleStore
OIDC oidc.Store
Passkeys passkey.Store
PasswordReset passwordreset.Store
RefreshTokens refreshtoken.Store
SAML saml.Store
Sessions sessiontoken.Store
TOTP totp.Store
AccessSessions AccessSessionStore
}
type TOTPConfig ¶
type TOTPConfig struct {
Enabled bool
EnrollmentLifetime time.Duration
ChallengeLifetime time.Duration
RecoveryCodeCount int
AttemptGuard totp.AttemptGuard
SecurityEvents totp.SecurityEventSink
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package accesstoken issues and verifies short-lived JWT access tokens.
|
Package accesstoken issues and verifies short-lived JWT access tokens. |
|
Package emailaddress normalizes email identities.
|
Package emailaddress normalizes email identities. |
|
Package emailpassword orchestrates email and password authentication.
|
Package emailpassword orchestrates email and password authentication. |
|
Package emailverification manages email ownership verification.
|
Package emailverification manages email ownership verification. |
|
Package googleoauth provides Google Authorization Code flow orchestration.
|
Package googleoauth provides Google Authorization Code flow orchestration. |
|
internal
|
|
|
Package oidc provides OpenID Connect authentication orchestration.
|
Package oidc provides OpenID Connect authentication orchestration. |
|
Package passkey manages WebAuthn passkey registration and authentication.
|
Package passkey manages WebAuthn passkey registration and authentication. |
|
Package passwordreset manages password recovery with emailed tokens.
|
Package passwordreset manages password recovery with emailed tokens. |
|
Package refreshtoken manages opaque tokens that renew JWT access tokens.
|
Package refreshtoken manages opaque tokens that renew JWT access tokens. |
|
Package saml provides SAML Web SSO orchestration for service providers.
|
Package saml provides SAML Web SSO orchestration for service providers. |
|
Package sessiontoken manages opaque server-side sessions.
|
Package sessiontoken manages opaque server-side sessions. |
|
storage
|
|
|
mongodb
Package mongodb provides Authlier storage backed by MongoDB.
|
Package mongodb provides Authlier storage backed by MongoDB. |
|
mysql
Package mysql provides Authlier storage backed by MySQL.
|
Package mysql provides Authlier storage backed by MySQL. |
|
postgres
Package postgres provides Authlier storage backed by PostgreSQL.
|
Package postgres provides Authlier storage backed by PostgreSQL. |
|
redis
Package redis provides Authlier storage and optional session caching backed by Redis.
|
Package redis provides Authlier storage and optional session caching backed by Redis. |
|
Package token generates and hashes opaque bearer credentials.
|
Package token generates and hashes opaque bearer credentials. |
|
Package totp manages authenticator-app MFA and recovery codes.
|
Package totp manages authenticator-app MFA and recovery codes. |
Click to show internal directories.
Click to hide internal directories.