Documentation
¶
Index ¶
- Constants
- Variables
- func NewErrDuplicatedAuthenticator(typ model.AuthenticatorType) error
- type Filter
- type FilterFunc
- type Info
- func (i *Info) AMR() []string
- func (i *Info) CanHaveMFA() bool
- func (i *Info) Equal(that *Info) bool
- func (i *Info) GetMeta() model.Meta
- func (i *Info) IsApplicableTo(iden *identity.Info) bool
- func (i *Info) IsDependentOf(iden *identity.Info) bool
- func (i *Info) IsIndependent() bool
- func (i *Info) StandardClaims() map[model.ClaimName]string
- func (i *Info) ToAuthentication() model.AuthenticationFlowAuthentication
- func (i *Info) ToModel() model.Authenticator
- func (i *Info) ToPublicClaims() map[string]interface{}
- func (i *Info) ToRef() *Ref
- func (i *Info) UpdateUserID(newUserID string) *Info
- type Kind
- type MigrateSpec
- type OOBOTP
- type OOBOTPMigrateSpec
- type OOBOTPSpec
- type Passkey
- type PasskeySpec
- type Password
- type PasswordSpec
- type Ref
- type Spec
- type TOTP
- type TOTPSpec
Constants ¶
View Source
const ( // AuthenticatorClaimOOBOTPEmail is a claim with string value for OOB OTP email channel. AuthenticatorClaimOOBOTPEmail string = "https://authgear.com/claims/oob_otp/email" // AuthenticatorClaimOOBOTPPhone is a claim with string value for OOB OTP phone channel. AuthenticatorClaimOOBOTPPhone string = "https://authgear.com/claims/oob_otp/phone" )
View Source
const ( // AuthenticatorClaimPasskeyCredentialID is a claim with a string value. // nolint: gosec AuthenticatorClaimPasskeyCredentialID string = "https://authgear.com/claims/passkey/credential_id" )
View Source
const ( // AuthenticatorClaimTOTPDisplayName is a claim with string value for TOTP display name. AuthenticatorClaimTOTPDisplayName string = "https://authgear.com/claims/totp/display_name" )
Variables ¶
View Source
var ErrAuthenticatorNotFound = errors.New("authenticator not found")
View Source
var KeepPrimaryAuthenticatorCanHaveMFA = FilterFunc(func(ai *Info) bool {
return ai.CanHaveMFA()
})
Functions ¶
func NewErrDuplicatedAuthenticator ¶
func NewErrDuplicatedAuthenticator(typ model.AuthenticatorType) error
Types ¶
type Filter ¶
func KeepType ¶
func KeepType(types ...model.AuthenticatorType) Filter
type FilterFunc ¶
var KeepDefault FilterFunc = func(ai *Info) bool {
return ai.IsDefault
}
func (FilterFunc) Keep ¶
func (f FilterFunc) Keep(ai *Info) bool
type Info ¶
type Info struct {
ID string `json:"id"`
UserID string `json:"user_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Type model.AuthenticatorType `json:"type"`
IsDefault bool `json:"is_default"`
Kind Kind `json:"kind"`
Password *Password `json:"password,omitempty"`
Passkey *Passkey `json:"passkey,omitempty"`
TOTP *TOTP `json:"totp,omitempty"`
OOBOTP *OOBOTP `json:"oobotp,omitempty"`
}
func ApplyFilters ¶
func (*Info) CanHaveMFA ¶
func (*Info) IsIndependent ¶
func (*Info) ToAuthentication ¶
func (i *Info) ToAuthentication() model.AuthenticationFlowAuthentication
func (*Info) ToModel ¶
func (i *Info) ToModel() model.Authenticator
func (*Info) ToPublicClaims ¶
func (*Info) UpdateUserID ¶
type Kind ¶
type Kind = model.AuthenticatorKind
const ( KindPrimary Kind = model.AuthenticatorKindPrimary KindSecondary Kind = model.AuthenticatorKindSecondary )
type MigrateSpec ¶
type MigrateSpec struct {
Type model.AuthenticatorType `json:"type,omitempty"`
OOBOTP *OOBOTPMigrateSpec `json:"oobotp,omitempty"`
}
func (*MigrateSpec) GetSpec ¶
func (s *MigrateSpec) GetSpec() *Spec
type OOBOTP ¶
type OOBOTP struct {
ID string `json:"id"`
UserID string `json:"user_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Kind string `json:"kind"`
IsDefault bool `json:"is_default"`
OOBAuthenticatorType model.AuthenticatorType `json:"oob_authenticator_type"`
Phone string `json:"phone,omitempty"`
Email string `json:"email,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
func (*OOBOTP) LastUsedChannel ¶
func (a *OOBOTP) LastUsedChannel() model.AuthenticatorOOBChannel
func (*OOBOTP) SetLastUsedChannel ¶
func (a *OOBOTP) SetLastUsedChannel(lastUsedChannel model.AuthenticatorOOBChannel)
func (*OOBOTP) ToClaimPair ¶
type OOBOTPMigrateSpec ¶
type OOBOTPSpec ¶
type Passkey ¶
type Passkey struct {
ID string `json:"id"`
UserID string `json:"user_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Kind string `json:"kind"`
IsDefault bool `json:"is_default"`
CredentialID string `json:"credential_id"`
CreationOptions *model.WebAuthnCreationOptions `json:"creation_options,omitempty"`
AttestationResponse []byte `json:"attestation_response,omitempty"`
// SignCount of 0 means sign count is not supported by the authenticator.
// So we do not include omitempty here.
SignCount int64 `json:"sign_count"`
}
type PasskeySpec ¶
type Password ¶
type Password struct {
ID string `json:"id"`
UserID string `json:"user_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Kind string `json:"kind"`
IsDefault bool `json:"is_default"`
PasswordHash []byte `json:"password_hash,omitempty"`
ExpireAfter *time.Time `json:"expire_after,omitempty"`
}
type PasswordSpec ¶
type Spec ¶
type Spec struct {
UserID string `json:"user_id,omitempty"`
Type model.AuthenticatorType `json:"type,omitempty"`
IsDefault bool `json:"is_default,omitempty"`
Kind Kind `json:"kind,omitempty"`
Password *PasswordSpec `json:"password,omitempty"`
Passkey *PasskeySpec `json:"passkey,omitempty"`
TOTP *TOTPSpec `json:"totp,omitempty"`
OOBOTP *OOBOTPSpec `json:"oobotp,omitempty"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.