Documentation
¶
Index ¶
- Variables
- type Authentication
- type AuthenticationObjective
- type AuthenticationStage
- type B
- type Backend
- type Identity
- type IdentityData
- type IdentityInfo
- type IdentitySummary
- type M
- type Manager
- type OAuth2Verifier
- type Options
- type RegularVerifier
- type ReverseVerifier
- type Session
- func (sess *Session) CancelAuthentication(ctx context.Context) error
- func (sess *Session) CheckStatus(ctx context.Context) (Status, error)
- func (sess *Session) Info() (sid, uid string)
- func (sess *Session) ListMyIdentitiesAndVerifiers(ctx context.Context) (idn []IdentityData, ver []VerifierSummary, err error)
- func (sess *Session) ListSupportedIdentitiesAndVerifiers() (idn []IdentitySummary, ver []VerifierSummary, err error)
- func (sess *Session) LoginAs(uid string) (sid string, err error)
- func (sess *Session) Logout(ctx context.Context) (*Status, error)
- func (sess *Session) Start(ctx context.Context, verifierName string, args M, ...) (M, error)
- func (sess *Session) StartAuthentication(ctx context.Context, objective AuthenticationObjective) error
- func (sess *Session) Verify(ctx context.Context, ...) error
- type StaticVerifier
- type Status
- type StatusAuthenticated
- type StatusAuthenticating
- type StatusCompletedFactors
- type User
- type Verifier
- type VerifierData
- type VerifierInfo
- type VerifierSummary
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrVerificationCodeMismatch = errors.New("verification code mismatch")
Functions ¶
This section is empty.
Types ¶
type Authentication ¶
type Authentication struct {
ID string `bson:"_id" json:"SessionToken"`
Objective AuthenticationObjective `bson:"Objective" json:"Objective"`
Completed bool `bson:"Completed" json:"Completed"`
//> Filled if user is authenticated and going to add new identity/verifier (AuthenticationObjective)
// or if user completed one of the factors
UserID string `bson:"UserID" json:"UserID"`
RequiredFactorsCount int `bson:"RequiredFactorsCount" json:"RequiredFactorsCount"`
Stages []*AuthenticationStage `bson:"Stages" json:"Stages"`
CreationTime time.Time `bson:"CreationTime" json:"CreationTime"`
Version int `bson:"Version" json:"Version"`
}
type AuthenticationObjective ¶
type AuthenticationObjective string
const ( ObjectiveSignIn AuthenticationObjective = "sign_in" ObjectiveSignUp AuthenticationObjective = "sign_up" ObjectiveAttach AuthenticationObjective = "attach" )
type AuthenticationStage ¶
type AuthenticationStage struct {
Completed bool `bson:"Completed" json:"Completed"`
UserID string `bson:"UserID" json:"UserID"`
VerifierName string `bson:"VerifierName" json:"VerifierName"`
IdentityName string `bson:"IdentityName" json:"IdentityName"`
Identity string `bson:"Identity" json:"Identity"`
StoredSecurityCode string `bson:"StoredSecurityCode" json:"StoredSecurityCode"`
InputSecurityCode string `bson:"InputSecurityCode" json:"InputSecurityCode"`
OAuth2State string `bson:"OAuth2State" json:"OAuth2State"`
VerifierData *VerifierData `bson:"VerifierData" json:"VerifierData"`
}
type Backend ¶
type Backend interface {
GetAuthentication(ctx context.Context, id string) (*Authentication, error)
CreateAuthentication(ctx context.Context, id string, objective AuthenticationObjective, userID string) (*Authentication, error)
SaveAuthentication(ctx context.Context, auth *Authentication) (*Authentication, error)
RemoveAuthentication(ctx context.Context, id string) error
GetUser(ctx context.Context, id string) (*User, error)
CreateUser(ctx context.Context, user *User) (*User, error)
SaveUser(ctx context.Context, user *User) (*User, error)
GetUserByIdentity(ctx context.Context, identityName, identity string) (*User, error)
}
type Identity ¶
type Identity interface {
Info() IdentityInfo
NormalizeAndValidateIdentity(idn string) (idnNormalized string, err error)
}
type IdentityData ¶
type IdentityInfo ¶
type IdentityInfo struct {
Name string
}
type IdentitySummary ¶
type IdentitySummary struct {
Name string
Standalone bool
Identity Identity
Verifiers []*VerifierSummary
}
type OAuth2Verifier ¶
type RegularVerifier ¶
type ReverseVerifier ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) CancelAuthentication ¶
func (*Session) ListMyIdentitiesAndVerifiers ¶
func (sess *Session) ListMyIdentitiesAndVerifiers(ctx context.Context) (idn []IdentityData, ver []VerifierSummary, err error)
FIXME Why IdentityData??? Not summary???
func (*Session) ListSupportedIdentitiesAndVerifiers ¶
func (sess *Session) ListSupportedIdentitiesAndVerifiers() (idn []IdentitySummary, ver []VerifierSummary, err error)
func (*Session) StartAuthentication ¶
func (sess *Session) StartAuthentication(ctx context.Context, objective AuthenticationObjective) error
type StaticVerifier ¶
type Status ¶
type Status struct {
Token string
Authenticating *StatusAuthenticating
Authenticated *StatusAuthenticated
}
type StatusAuthenticated ¶
type StatusAuthenticated struct {
User string
}
type StatusAuthenticating ¶
type StatusAuthenticating struct {
Objective AuthenticationObjective
RemainingFactors int
CompletedFactors []StatusCompletedFactors
}
type StatusCompletedFactors ¶
type User ¶
type User struct {
ID string `bson:"_id" json:"ID"`
// TODO
LastVerificationTime int64 `bson:"LastVerificationTime" json:"LastVerificationTime"`
Identities []IdentityData `bson:"Identities" json:"Identities"` // /name/identity/**
Verifiers []VerifierData `bson:"Verifiers" json:"Verifiers"`
AuthFactorsNumber int `bson:"AuthFactorsNumber" json:"AuthFactorsNumber"`
Version int `bson:"Version" json:"Version"`
}
type Verifier ¶
type Verifier interface {
Info() VerifierInfo
}
type VerifierData ¶
type VerifierInfo ¶
Click to show internal directories.
Click to hide internal directories.