Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyAllEffects(ctx context.Context, deps *Dependencies, flows Flows) error
- func ApplyRunEffects(ctx context.Context, deps *Dependencies, flows Flows) error
- func AsInput(i Input, iface interface{}) bool
- func CollectCookies(ctx context.Context, deps *Dependencies, flows Flows) (cookies []*http.Cookie, err error)
- func FindAllMilestones[T Milestone](w *Flow) []T
- func FlowObject(flowRootObject config.AuthenticationFlowObject, pointer jsonpointer.T) (config.AuthenticationFlowObject, error)
- func FlowObjectGetName(o config.AuthenticationFlowObject) string
- func FlowObjectGetOneOf(o config.AuthenticationFlowObject) ([]config.AuthenticationFlowObject, bool)
- func FlowObjectGetSteps(o config.AuthenticationFlowObject) ([]config.AuthenticationFlowObject, bool)
- func GetAuthenticationInfoEntry(ctx context.Context, deps *Dependencies, flows Flows) (*authenticationinfo.Entry, bool)
- func GetCurrentObject(entries []TraverseEntry) (config.AuthenticationFlowObject, error)
- func GetFlowID(ctx context.Context) string
- func GetIDToken(ctx context.Context) string
- func GetLoginHint(ctx context.Context) string
- func GetOAuthSessionID(ctx context.Context) string
- func GetSAMLSessionID(ctx context.Context) string
- func GetSuppressIDPSessionCookie(ctx context.Context) bool
- func GetUserIDHint(ctx context.Context) string
- func JSONPointerForOneOf(p jsonpointer.T, index int) jsonpointer.T
- func JSONPointerForStep(p jsonpointer.T, index int) jsonpointer.T
- func JSONPointerSubtract(p1 jsonpointer.T, p2 jsonpointer.T) jsonpointer.T
- func JSONPointerToParent(p jsonpointer.T) jsonpointer.T
- func NewWebsocketChannelName() string
- func RegisterFlow(flow PublicFlow)
- func RegisterIntent(intent Intent)
- func RegisterNode(node NodeSimple)
- func TraverseFlow(t Traverser, w *Flow) error
- func TraverseFlowIntentFirst(t Traverser, w *Flow) error
- func TraverseIntentFromEndToRoot(t IntentTraverser, w *Flow) error
- func TraverseNode(t Traverser, w *Flow, n *Node) error
- func TraverseNodeIntentFirst(t Traverser, w *Flow, n *Node) error
- func WebsocketChannelName(r *http.Request) string
- func WebsocketURL(origin string, channel string) (websocketURL string, err error)
- type AcceptResult
- type AccountMigrationService
- type AnonymousIdentityService
- type AnonymousUserPromotionCodeStore
- type AuthenticationInfoEntryGetter
- type AuthenticationInfoService
- type AuthenticatorService
- type BotProtectionService
- type BotProtectionVerificationOutcome
- type BotProtectionVerificationResult
- type CaptchaService
- type ChallengeService
- type CookieGetter
- type CookieManager
- type CustomAttrsService
- type Data
- type DataFinishRedirectURI
- type DataOutputer
- type Dependencies
- type Effect
- type EffectGetter
- type EndOfFlowDataOutputer
- type ErrorBotProtectionVerification
- type ErrorBotProtectionVerificationStatus
- type ErrorRewriteFlow
- type ErrorSwitchFlow
- type Event
- type EventKind
- type EventRefresh
- type EventService
- type FindInputReactorResult
- func FindInputReactor(ctx context.Context, deps *Dependencies, flows Flows) (*FindInputReactorResult, error)
- func FindInputReactorForFlow(ctx context.Context, deps *Dependencies, flows Flows) (*FindInputReactorResult, error)
- func FindInputReactorForNode(ctx context.Context, deps *Dependencies, flows Flows, n *Node) (*FindInputReactorResult, error)
- type Flow
- type FlowAction
- type FlowActionType
- type FlowAllowlist
- type FlowReference
- type FlowResponse
- type FlowType
- type Flows
- type ForgotPasswordService
- type IDPSessionService
- type IDTokenService
- type IdentityService
- type Input
- type InputReactor
- type InputSchema
- type InputTakeAccountRecoveryCode
- type InputUnwrapper
- type Intent
- type IntentTraverser
- type IntlMiddleware
- type JSONResponseWriter
- type Kinder
- type LDAPClientFactory
- type LDAPService
- type LoginIDService
- type MFAService
- type Milestone
- type Node
- type NodeOrIntent
- type NodeSimple
- type NodeType
- type OAuthClientResolver
- type OAuthProviderFactory
- type OTPCodeService
- type OTPSender
- type OfflineGrantStore
- type OnCommitEffect
- type PasskeyCreationOptionsService
- type PasskeyRequestOptionsService
- type PasskeyService
- type PublicFlow
- type RateLimitMiddleware
- type RateLimiter
- type ResetPasswordService
- type RunEffect
- type Service
- func (s *Service) CreateNewFlow(ctx context.Context, publicFlow PublicFlow, sessionOptions *SessionOptions) (output *ServiceOutput, err error)
- func (s *Service) FeedInput(ctx context.Context, stateToken string, rawMessage json.RawMessage) (output *ServiceOutput, err error)
- func (s *Service) FeedSyntheticInput(ctx context.Context, stateToken string, syntheticInput Input) (output *ServiceOutput, err error)
- func (s *Service) Get(ctx context.Context, stateToken string) (output *ServiceOutput, err error)
- type ServiceDatabase
- type ServiceLogger
- type ServiceOutput
- type ServiceUIInfoResolver
- type Session
- type SessionOptions
- type SessionOutput
- type SessionService
- type StdAttrsService
- type Store
- type StoreImpl
- func (s *StoreImpl) CreateFlow(ctx context.Context, flow *Flow) error
- func (s *StoreImpl) CreateSession(ctx context.Context, session *Session) error
- func (s *StoreImpl) DeleteFlow(ctx context.Context, flow *Flow) error
- func (s *StoreImpl) DeleteSession(ctx context.Context, session *Session) error
- func (s *StoreImpl) GetFlowByStateToken(ctx context.Context, stateToken string) (*Flow, error)
- func (s *StoreImpl) GetSession(ctx context.Context, flowID string) (*Session, error)
- func (s *StoreImpl) UpdateSession(ctx context.Context, session *Session) error
- type TargetStep
- type TraverseEntry
- type Traverser
- type UserFacade
- type UserService
- type VerificationService
- type WebsocketEventStore
Constants ¶
const ( JsonPointerTokenOneOf string = "one_of" JsonPointerTokenSteps string = "steps" )
const ( BotProtectionVerificationOutcomeFailed = "failed" BotProtectionVerificationOutcomeVerified = "verified" )
const (
AuthowAPIPerIP ratelimit.BucketName = "AuthflowAPIPerIP"
)
const Lifetime = duration.UserInteraction
const (
WebsocketEndpointV1 = "/api/v1/authentication_flows/ws"
)
Variables ¶
var AllFlowTypes []FlowType = []FlowType{ FlowTypeSignup, FlowTypePromote, FlowTypeLogin, FlowTypeSignupLogin, FlowTypeReauth, FlowTypeAccountRecovery, }
var DependencySet = wire.NewSet( wire.Struct(new(Dependencies), "*"), NewServiceLogger, wire.Struct(new(Service), "*"), wire.Struct(new(StoreImpl), "*"), wire.Bind(new(Store), new(*StoreImpl)), wire.Struct(new(IntlMiddleware), "*"), wire.Struct(new(RateLimitMiddleware), "*"), NewWebsocketEventStore, )
var ErrEOF = errors.New("eof")
ErrEOF means end of flow. This error originates from CanReactTo and will be propagated to public API.
var ErrFlowNotAllowed = apierrors.Forbidden.WithReason("AuthenticationFlowNotAllowed").New("flow not allowed")
var ErrFlowNotFound = apierrors.NotFound.WithReason("AuthenticationFlowNotFound").New("flow not found")
var ErrIncompatibleInput = errors.New("incompatible input")
ErrIncompatibleInput means the input reactor cannot react to the input. This error can only be returned by ReactTo.
var ErrInvalidJSONPointer = errors.New("invalid json pointer")
var ErrNoChange = errors.New("no change")
ErrNoChange means the input does not cause the flow to change. This error originates from Accept and will be propagated to public API.
var ErrNoEntries = errors.New("no entries")
var ErrSameNode = errors.New("same node")
ErrSameNode means the input is reacted to, but no node is produced. This typically means the node has performed some immediate side effects. This error can only be returned by ReactTo.
var ErrStepNotFound = apierrors.NotFound.WithReason("AuthenticationFlowStepNotFound").New("step not found")
var ErrUnknownFlow = apierrors.BadRequest.WithReason("AuthenticationFlowUnknownFlow").New("unknown flow")
var ErrUpdateNode = errors.New("update node")
ErrUpdateNode means the input is reacted to, but instead of producing a new node to be appended, the returned node should replace the node. This error can only be returned by ReactTo.
var InputTakeAccountRecoveryCodeSchemaBuilder validation.SchemaBuilder
Functions ¶
func ApplyAllEffects ¶
func ApplyAllEffects(ctx context.Context, deps *Dependencies, flows Flows) error
func ApplyRunEffects ¶
func ApplyRunEffects(ctx context.Context, deps *Dependencies, flows Flows) error
func CollectCookies ¶
func FindAllMilestones ¶
func FlowObject ¶
func FlowObject(flowRootObject config.AuthenticationFlowObject, pointer jsonpointer.T) (config.AuthenticationFlowObject, error)
func FlowObjectGetName ¶
func FlowObjectGetName(o config.AuthenticationFlowObject) string
func FlowObjectGetOneOf ¶
func FlowObjectGetOneOf(o config.AuthenticationFlowObject) ([]config.AuthenticationFlowObject, bool)
func FlowObjectGetSteps ¶
func FlowObjectGetSteps(o config.AuthenticationFlowObject) ([]config.AuthenticationFlowObject, bool)
func GetAuthenticationInfoEntry ¶
func GetAuthenticationInfoEntry(ctx context.Context, deps *Dependencies, flows Flows) (*authenticationinfo.Entry, bool)
func GetCurrentObject ¶
func GetCurrentObject(entries []TraverseEntry) (config.AuthenticationFlowObject, error)
func GetIDToken ¶
func GetLoginHint ¶
func GetOAuthSessionID ¶
func GetSAMLSessionID ¶
func GetUserIDHint ¶
func JSONPointerForOneOf ¶
func JSONPointerForOneOf(p jsonpointer.T, index int) jsonpointer.T
func JSONPointerForStep ¶
func JSONPointerForStep(p jsonpointer.T, index int) jsonpointer.T
func JSONPointerSubtract ¶
func JSONPointerSubtract(p1 jsonpointer.T, p2 jsonpointer.T) jsonpointer.T
func JSONPointerToParent ¶
func JSONPointerToParent(p jsonpointer.T) jsonpointer.T
func NewWebsocketChannelName ¶
func NewWebsocketChannelName() string
func RegisterIntent ¶
func RegisterIntent(intent Intent)
func RegisterNode ¶
func RegisterNode(node NodeSimple)
func TraverseFlow ¶
TraverseFlow traverse the flow, and intent of the flow is treated as the last node of the flow
func TraverseFlowIntentFirst ¶
TraverseFlowIntentFirst is same as TraverseFlow, except that it ensures all nodes and intents must be traversed in the order they are inserted to the flow i.e. The intent will invoke the Traverser before the nodes belongs that intent
func TraverseIntentFromEndToRoot ¶
func TraverseIntentFromEndToRoot(t IntentTraverser, w *Flow) error
func WebsocketChannelName ¶
Types ¶
type AcceptResult ¶
type AcceptResult struct {
BotProtectionVerificationResult *BotProtectionVerificationResult `json:"bot_protection,omitempty"`
}
func Accept ¶
func Accept(ctx context.Context, deps *Dependencies, flows Flows, rawMessage json.RawMessage) (*AcceptResult, error)
Accept executes the flow to the deepest using input. In addition to the errors caused by intents and nodes, ErrEOF and ErrNoChange can be returned.
func AcceptSyntheticInput ¶
func AcceptSyntheticInput(ctx context.Context, deps *Dependencies, flows Flows, syntheticInput Input) (result *AcceptResult, err error)
type AccountMigrationService ¶
type AccountMigrationService interface {
Run(ctx context.Context, migrationTokenString string) (*accountmigration.HookResponse, error)
}
type AnonymousIdentityService ¶
type AnonymousIdentityService interface { ParseRequestUnverified(requestJWT string) (*anonymous.Request, error) ParseRequest(requestJWT string, identity *identity.Anonymous) (*anonymous.Request, error) Get(ctx context.Context, userID string, id string) (*identity.Anonymous, error) GetByKeyID(ctx context.Context, keyID string) (*identity.Anonymous, error) }
type AuthenticationInfoEntryGetter ¶
type AuthenticationInfoEntryGetter interface {
GetAuthenticationInfoEntry(ctx context.Context, deps *Dependencies, flows Flows) *authenticationinfo.Entry
}
type AuthenticationInfoService ¶
type AuthenticationInfoService interface {
Save(ctx context.Context, entry *authenticationinfo.Entry) error
}
type AuthenticatorService ¶
type AuthenticatorService interface { NewWithAuthenticatorID(ctx context.Context, authenticatorID string, spec *authenticator.Spec) (*authenticator.Info, error) UpdatePassword(ctx context.Context, ainfo *authenticator.Info, options *service.UpdatePasswordOptions) (changed bool, info *authenticator.Info, err error) Get(ctx context.Context, authenticatorID string) (*authenticator.Info, error) Create(ctx context.Context, authenticatorInfo *authenticator.Info, markVerified bool) error Update(ctx context.Context, authenticatorInfo *authenticator.Info) error List(ctx context.Context, userID string, filters ...authenticator.Filter) ([]*authenticator.Info, error) VerifyWithSpec(ctx context.Context, info *authenticator.Info, spec *authenticator.Spec, options *facade.VerifyOptions) (verifyResult *service.VerifyResult, err error) VerifyOneWithSpec(ctx context.Context, userID string, authenticatorType model.AuthenticatorType, infos []*authenticator.Info, spec *authenticator.Spec, options *facade.VerifyOptions) (info *authenticator.Info, verifyResult *service.VerifyResult, err error) ClearLockoutAttempts(ctx context.Context, userID string, usedMethods []config.AuthenticationLockoutMethod) error }
type BotProtectionService ¶
type BotProtectionVerificationOutcome ¶
type BotProtectionVerificationOutcome string
type BotProtectionVerificationResult ¶
type BotProtectionVerificationResult struct { Outcome BotProtectionVerificationOutcome `json:"outcome,omitempty"` Response interface{} `json:"response,omitempty"` }
func GetBotProtectionVerificationResult ¶
func GetBotProtectionVerificationResult(ctx context.Context) *BotProtectionVerificationResult
type CaptchaService ¶
type ChallengeService ¶
type CookieGetter ¶
type CookieManager ¶
type CustomAttrsService ¶
type Data ¶
type Data interface {
Data()
}
Data is a marker. Ensure all data is a struct, not an ad-hoc map.
type DataFinishRedirectURI ¶
type DataFinishRedirectURI struct {
FinishRedirectURI string `json:"finish_redirect_uri,omitempty"`
}
func (*DataFinishRedirectURI) Data ¶
func (*DataFinishRedirectURI) Data()
type DataOutputer ¶
type DataOutputer interface { InputReactor OutputData(ctx context.Context, deps *Dependencies, flows Flows) (Data, error) }
DataOutputer is an InputReactor. The data it outputs allow the caller to proceed.
type Dependencies ¶
type Dependencies struct { Config *config.AppConfig FeatureConfig *config.FeatureConfig Clock clock.Clock RemoteIP httputil.RemoteIP HTTPOrigin httputil.HTTPOrigin HTTPRequest *http.Request Users UserService Identities IdentityService AnonymousIdentities AnonymousIdentityService AnonymousUserPromotionCodeStore AnonymousUserPromotionCodeStore Authenticators AuthenticatorService MFA MFAService StdAttrsService StdAttrsService CustomAttrsService CustomAttrsService OTPCodes OTPCodeService OTPSender OTPSender Verification VerificationService ForgotPassword ForgotPasswordService ResetPassword ResetPasswordService AccountMigrations AccountMigrationService Challenges ChallengeService Captcha CaptchaService BotProtection BotProtectionService OAuthProviderFactory OAuthProviderFactory PasskeyRequestOptionsService PasskeyRequestOptionsService PasskeyCreationOptionsService PasskeyCreationOptionsService PasskeyService PasskeyService LoginIDs LoginIDService LDAP LDAPService LDAPClientFactory LDAPClientFactory IDPSessions IDPSessionService Sessions SessionService AuthenticationInfos AuthenticationInfoService SessionCookie session.CookieDef MFADeviceTokenCookie mfa.CookieDef UserFacade UserFacade Cookies CookieManager Events EventService RateLimiter RateLimiter OfflineGrants OfflineGrantStore IDTokens IDTokenService }
type EffectGetter ¶
type EndOfFlowDataOutputer ¶
type EndOfFlowDataOutputer interface { PublicFlow OutputEndOfFlowData(ctx context.Context, deps *Dependencies, flows Flows, baseData *DataFinishRedirectURI) (Data, error) }
EndOfFlowDataOutputer is an optional interface to be implemented by PublicFlow. The implementation MUST return a Data that contains baseData.
type ErrorBotProtectionVerification ¶
type ErrorBotProtectionVerification struct {
Status ErrorBotProtectionVerificationStatus
}
ErrorBotProtectionVerification is a special error for interrupting the flow in case of failed or service-unavailable
var ( ErrorBotProtectionVerificationFailed *ErrorBotProtectionVerification = &ErrorBotProtectionVerification{ Status: ErrorBotProtectionVerificationStatusFailed, } ErrorBotProtectionVerificationSuccess *ErrorBotProtectionVerification = &ErrorBotProtectionVerification{ Status: ErrorBotProtectionVerificationStatusSuccess, } Status: ErrorBotProtectionVerificationStatusServiceUnavailable, } )
func (*ErrorBotProtectionVerification) Error ¶
func (e *ErrorBotProtectionVerification) Error() string
type ErrorBotProtectionVerificationStatus ¶
type ErrorBotProtectionVerificationStatus string
const ( ErrorBotProtectionVerificationStatusFailed ErrorBotProtectionVerificationStatus = "failed" ErrorBotProtectionVerificationStatusSuccess ErrorBotProtectionVerificationStatus = "success" )
type ErrorRewriteFlow ¶
type ErrorRewriteFlow struct { Intent Intent Nodes []Node // SyntheticInput advance the rewritten flow at the current state. SyntheticInput Input }
ErrorRewriteFlow is a special error for rewriting the flow.
func (*ErrorRewriteFlow) Error ¶
func (e *ErrorRewriteFlow) Error() string
type ErrorSwitchFlow ¶
type ErrorSwitchFlow struct { // FlowReference indicates the flow to switch to. FlowReference FlowReference // SyntheticInput advance the switched flow at the current state. // It MUST include the input that triggers this error. SyntheticInput Input }
ErrorSwitchFlow is a special error for switching flow.
func (*ErrorSwitchFlow) Error ¶
func (e *ErrorSwitchFlow) Error() string
type EventKind ¶
type EventKind string
const ( // EventKindRefresh indicates client should re-fetch current state of flow for updated state. EventKindRefresh EventKind = "refresh" )
type EventRefresh ¶
type EventRefresh struct {
Kind EventKind `json:"kind"`
}
func NewEventRefresh ¶
func NewEventRefresh() *EventRefresh
type EventService ¶
type FindInputReactorResult ¶
type FindInputReactorResult struct { Flows Flows InputReactor InputReactor InputSchema InputSchema }
func FindInputReactor ¶
func FindInputReactor(ctx context.Context, deps *Dependencies, flows Flows) (*FindInputReactorResult, error)
func FindInputReactorForFlow ¶
func FindInputReactorForFlow(ctx context.Context, deps *Dependencies, flows Flows) (*FindInputReactorResult, error)
func FindInputReactorForNode ¶
func FindInputReactorForNode(ctx context.Context, deps *Dependencies, flows Flows, n *Node) (*FindInputReactorResult, error)
type FlowAction ¶
type FlowAction struct { Type FlowActionType `json:"type"` Identification config.AuthenticationFlowIdentification `json:"identification,omitempty"` Authentication config.AuthenticationFlowAuthentication `json:"authentication,omitempty"` Data Data `json:"data,omitempty"` }
FlowAction is an API object.
func GetFlowAction ¶
func GetFlowAction(flowRootObject config.AuthenticationFlowObject, pointer jsonpointer.T) *FlowAction
type FlowActionType ¶
type FlowActionType string
const (
FlowActionTypeFinished FlowActionType = "finished"
)
func FlowActionTypeFromStepType ¶
func FlowActionTypeFromStepType(t config.AuthenticationFlowStepType) FlowActionType
type FlowAllowlist ¶
type FlowAllowlist struct { DefinedGroups []*config.UIAuthenticationFlowGroup AllowedGroups []*config.AuthenticationFlowAllowlistGroup AllowedFlows []*config.AuthenticationFlowAllowlistFlow }
FlowAllowlist contains union of flow group and flow allowlist.
func NewFlowAllowlist ¶
func NewFlowAllowlist(allowlist *config.AuthenticationFlowAllowlist, definedGroups []*config.UIAuthenticationFlowGroup) FlowAllowlist
func (FlowAllowlist) CanCreateFlow ¶
func (a FlowAllowlist) CanCreateFlow(flowReference FlowReference) bool
func (FlowAllowlist) DeriveFlowNameForDefaultUI ¶
func (a FlowAllowlist) DeriveFlowNameForDefaultUI(flowType FlowType, flowGroup string) (string, error)
type FlowReference ¶
FlowReference is an API object.
func FindCurrentFlowReference ¶
func FindCurrentFlowReference(flow *Flow) *FlowReference
type FlowResponse ¶
type FlowResponse struct { StateToken string `json:"state_token"` Type FlowType `json:"type,omitempty"` Name string `json:"name,omitempty"` Action *FlowAction `json:"action,omitempty"` }
FlowResponse is an API object.
type Flows ¶
func FindMilestoneInCurrentFlow ¶
FindMilestoneInCurrentFlow find the last milestone in the flow. It does not recur into sub flows. If the found milestone is a node, then the returned flows is the same as flows. If the found milestone is a intent, then the returned flows is Nearest=intent.
type ForgotPasswordService ¶
type ForgotPasswordService interface { IsRateLimitError(err error, target string, channel forgotpassword.CodeChannel, kind forgotpassword.CodeKind) bool CodeLength(target string, channel forgotpassword.CodeChannel, kind forgotpassword.CodeKind) int SendCode(ctx context.Context, loginID string, options *forgotpassword.CodeOptions) error InspectState(ctx context.Context, target string, channel forgotpassword.CodeChannel, kind forgotpassword.CodeKind) (*otp.State, error) }
type IDPSessionService ¶
type IDPSessionService interface { MakeSession(*session.Attrs) (*idpsession.IDPSession, string) Create(ctx context.Context, s *idpsession.IDPSession) error Reauthenticate(ctx context.Context, idpSessionID string, amr []string) error }
type IDTokenService ¶
type IdentityService ¶
type IdentityService interface { New(ctx context.Context, userID string, spec *identity.Spec, options identity.NewIdentityOptions) (*identity.Info, error) UpdateWithSpec(ctx context.Context, is *identity.Info, spec *identity.Spec, options identity.NewIdentityOptions) (*identity.Info, error) Get(ctx context.Context, id string) (*identity.Info, error) SearchBySpec(ctx context.Context, spec *identity.Spec) (exactMatch *identity.Info, otherMatches []*identity.Info, err error) ListByClaim(ctx context.Context, name string, value string) ([]*identity.Info, error) ListByUser(ctx context.Context, userID string) ([]*identity.Info, error) CheckDuplicatedByUniqueKey(ctx context.Context, info *identity.Info) (*identity.Info, error) Create(ctx context.Context, is *identity.Info) error Update(ctx context.Context, oldIs *identity.Info, newIs *identity.Info) error Delete(ctx context.Context, is *identity.Info) error }
type InputReactor ¶
type InputReactor interface { CanReactTo(ctx context.Context, deps *Dependencies, flows Flows) (InputSchema, error) ReactTo(ctx context.Context, deps *Dependencies, flows Flows, input Input) (*Node, error) }
InputReactor, if can react to some input, must return an InputSchema. It must react to the Input produced by its InputSchema. As a special case, CanReactTo can return a nil InputSchema, which means the InputReactor can react to a nil Input.
type InputSchema ¶
type InputSchema interface { GetJSONPointer() jsonpointer.T GetFlowRootObject() config.AuthenticationFlowObject SchemaBuilder() validation.SchemaBuilder // MakeInput MUST return *validation.AggregateError if rawMessage does not validate against the JSON schema. MakeInput(rawMessage json.RawMessage) (Input, error) }
InputSchema validates and parses the input. It is associated with a json pointer which points to the a step, or a branch of a step.
type InputTakeAccountRecoveryCode ¶
type InputTakeAccountRecoveryCode struct {
AccountRecoveryCode string `json:"account_recovery_code"`
}
func MakeInputTakeAccountRecoveryCode ¶
func MakeInputTakeAccountRecoveryCode(rawMessage json.RawMessage) (*InputTakeAccountRecoveryCode, bool)
type InputUnwrapper ¶
type InputUnwrapper interface {
Unwrap() Input
}
InputUnwrapper is for advanced usage. This usage is not used at the moment.
type IntentTraverser ¶
type IntlMiddleware ¶
type IntlMiddleware struct{}
type JSONResponseWriter ¶
type JSONResponseWriter interface {
WriteResponse(rw http.ResponseWriter, resp *api.Response)
}
type LDAPClientFactory ¶
type LDAPClientFactory interface {
MakeClient(serverConfig *config.LDAPServerConfig) *ldap.Client
}
type LDAPService ¶
type LoginIDService ¶
type LoginIDService interface {
CheckAndNormalize(spec identity.LoginIDSpec) (normalized string, uniqueKey string, err error)
}
type MFAService ¶
type MFAService interface { GenerateRecoveryCodes(ctx context.Context) []string ListRecoveryCodes(ctx context.Context, userID string) ([]*mfa.RecoveryCode, error) ReplaceRecoveryCodes(ctx context.Context, userID string, codes []string) ([]*mfa.RecoveryCode, error) VerifyRecoveryCode(ctx context.Context, userID string, code string) (*mfa.RecoveryCode, error) ConsumeRecoveryCode(ctx context.Context, c *mfa.RecoveryCode) error GenerateDeviceToken(ctx context.Context) string CreateDeviceToken(ctx context.Context, userID string, token string) (*mfa.DeviceToken, error) VerifyDeviceToken(ctx context.Context, userID string, deviceToken string) error }
type Milestone ¶
type Milestone interface {
Milestone()
}
Milestone is a marker. The designed use case is to find out whether a particular milestone exists in the flow, or any of its subflows.
type Node ¶
type Node struct { Type NodeType `json:"type"` Simple NodeSimple `json:"simple,omitempty"` SubFlow *Flow `json:"flow,omitempty"` }
func NewNodeSimple ¶
func NewNodeSimple(simple NodeSimple) *Node
func NewSubFlow ¶
func (*Node) MarshalJSON ¶
func (*Node) UnmarshalJSON ¶
type NodeOrIntent ¶
type NodeOrIntent interface { Kinder }
type NodeSimple ¶
type NodeSimple interface { Kinder }
func InstantiateNode ¶
func InstantiateNode(kind string) (NodeSimple, error)
type OAuthClientResolver ¶
type OAuthClientResolver interface {
ResolveClient(clientID string) *config.OAuthClientConfig
}
type OAuthProviderFactory ¶
type OAuthProviderFactory interface { GetProviderConfig(alias string) (oauthrelyingparty.ProviderConfig, error) GetAuthorizationURL(ctx context.Context, alias string, options oauthrelyingparty.GetAuthorizationURLOptions) (string, error) GetUserProfile(ctx context.Context, alias string, options oauthrelyingparty.GetUserProfileOptions) (oauthrelyingparty.UserProfile, error) }
type OTPCodeService ¶
type OTPCodeService interface { GenerateOTP(ctx context.Context, kind otp.Kind, target string, form otp.Form, opt *otp.GenerateOptions) (string, error) VerifyOTP(ctx context.Context, kind otp.Kind, target string, otp string, opts *otp.VerifyOptions) error InspectState(ctx context.Context, kind otp.Kind, target string) (*otp.State, error) LookupCode(ctx context.Context, purpose otp.Purpose, code string) (target string, err error) SetSubmittedCode(ctx context.Context, kind otp.Kind, target string, code string) (*otp.State, error) }
type OfflineGrantStore ¶
type OnCommitEffect ¶
type OnCommitEffect func(ctx context.Context, deps *Dependencies) error
type PasskeyService ¶
type PublicFlow ¶
type PublicFlow interface { Intent FlowType() FlowType FlowInit(r FlowReference, startFrom jsonpointer.T) FlowFlowReference() FlowReference FlowRootObject(deps *Dependencies) (config.AuthenticationFlowObject, error) }
PublicFlow is a instantiable intent by the public.
func InstantiateFlow ¶
func InstantiateFlow(f FlowReference, startFrom jsonpointer.T) (PublicFlow, error)
InstantiateFlow is used by the HTTP layer to instantiate a Flow.
type RateLimitMiddleware ¶
type RateLimitMiddleware struct { RateLimiter RateLimiter RemoteIP httputil.RemoteIP JSON JSONResponseWriter Config *config.AppConfig }
type RateLimiter ¶
type RateLimiter interface { Allow(ctx context.Context, spec ratelimit.BucketSpec) (*ratelimit.FailedReservation, error) Reserve(ctx context.Context, spec ratelimit.BucketSpec) (*ratelimit.Reservation, *ratelimit.FailedReservation, error) Cancel(ctx context.Context, r *ratelimit.Reservation) }
type ResetPasswordService ¶
type ResetPasswordService interface { VerifyCode(ctx context.Context, code string) (state *otp.State, err error) VerifyCodeWithTarget(ctx context.Context, target string, code string, channel forgotpassword.CodeChannel, kind forgotpassword.CodeKind) (state *otp.State, err error) ResetPasswordByEndUser(ctx context.Context, code string, newPassword string) error ResetPasswordWithTarget(ctx context.Context, target string, code string, newPassword string, channel forgotpassword.CodeChannel, kind forgotpassword.CodeKind) error }
type Service ¶
type Service struct { Deps *Dependencies Logger ServiceLogger Store Store Database ServiceDatabase UIConfig *config.UIConfig UIInfoResolver ServiceUIInfoResolver OAuthClientResolver OAuthClientResolver }
func (*Service) CreateNewFlow ¶
func (s *Service) CreateNewFlow(ctx context.Context, publicFlow PublicFlow, sessionOptions *SessionOptions) (output *ServiceOutput, err error)
func (*Service) FeedInput ¶
func (s *Service) FeedInput(ctx context.Context, stateToken string, rawMessage json.RawMessage) (output *ServiceOutput, err error)
func (*Service) FeedSyntheticInput ¶
type ServiceDatabase ¶
type ServiceLogger ¶
func NewServiceLogger ¶
func NewServiceLogger(lf *log.Factory) ServiceLogger
type ServiceOutput ¶
type ServiceOutput struct { Session *Session SessionOutput *SessionOutput Flow *Flow FlowReference *FlowReference Finished bool FlowAction *FlowAction Cookies []*http.Cookie }
func (*ServiceOutput) ToFlowResponse ¶
func (o *ServiceOutput) ToFlowResponse() FlowResponse
type ServiceUIInfoResolver ¶
type ServiceUIInfoResolver interface {
SetAuthenticationInfoInQuery(redirectURI string, e *authenticationinfo.Entry) string
}
type Session ¶
type Session struct { FlowID string `json:"flow_id"` OAuthSessionID string `json:"oauth_session_id,omitempty"` SAMLSessionID string `json:"saml_session_id,omitempty"` ClientID string `json:"client_id,omitempty"` RedirectURI string `json:"redirect_uri,omitempty"` Prompt []string `json:"prompt,omitempty"` State string `json:"state,omitempty"` XState string `json:"x_state,omitempty"` UILocales string `json:"ui_locales,omitempty"` BotProtectionVerificationResult *BotProtectionVerificationResult `json:"bot_protection_verification_result,omitempty"` IDToken string `json:"id_token,omitempty"` SuppressIDPSessionCookie bool `json:"suppress_idp_session_cookie,omitempty"` UserIDHint string `json:"user_id_hint,omitempty"` LoginHint string `json:"login_hint,omitempty"` }
Session must not contain web session ID. This is to ensure webapp does not have privilege in authflow.
func NewSession ¶
func NewSession(opts *SessionOptions) *Session
func (*Session) MakeContext ¶
func (*Session) SetBotProtectionVerificationResult ¶
func (s *Session) SetBotProtectionVerificationResult(result *BotProtectionVerificationResult)
func (*Session) ToOutput ¶
func (s *Session) ToOutput() *SessionOutput
type SessionOptions ¶
type SessionOptions struct { OAuthSessionID string SAMLSessionID string ClientID string RedirectURI string Prompt []string State string XState string UILocales string BotProtectionVerificationResult *BotProtectionVerificationResult IDToken string SuppressIDPSessionCookie bool UserIDHint string LoginHint string }
func (*SessionOptions) PartiallyMergeFrom ¶
func (s *SessionOptions) PartiallyMergeFrom(o *SessionOptions) *SessionOptions
type SessionOutput ¶
type SessionService ¶
type SessionService interface {
RevokeWithoutEvent(ctx context.Context, s session.SessionBase) error
}
type StdAttrsService ¶
type Store ¶
type Store interface { CreateSession(ctx context.Context, session *Session) error GetSession(ctx context.Context, flowID string) (*Session, error) DeleteSession(ctx context.Context, session *Session) error UpdateSession(ctx context.Context, session *Session) error CreateFlow(ctx context.Context, flow *Flow) error GetFlowByStateToken(ctx context.Context, stateToken string) (*Flow, error) DeleteFlow(ctx context.Context, flow *Flow) error }
type StoreImpl ¶
func (*StoreImpl) CreateFlow ¶
func (*StoreImpl) CreateSession ¶
func (*StoreImpl) DeleteFlow ¶
func (*StoreImpl) DeleteSession ¶
func (*StoreImpl) GetFlowByStateToken ¶
func (*StoreImpl) GetSession ¶
type TargetStep ¶
type TargetStep interface { GetName() string GetJSONPointer() jsonpointer.T }
type TraverseEntry ¶
type TraverseEntry struct { FlowObject config.AuthenticationFlowObject JSONPointer jsonpointer.T Name string FieldName string Index int }
func Traverse ¶
func Traverse(o config.AuthenticationFlowObject, pointer jsonpointer.T) ([]TraverseEntry, error)
type UserFacade ¶
type UserService ¶
type UserService interface { Get(ctx context.Context, id string, role accesscontrol.Role) (*model.User, error) GetRaw(ctx context.Context, id string) (*user.User, error) Create(ctx context.Context, userID string) (*user.User, error) UpdateLoginTime(ctx context.Context, userID string, t time.Time) error UpdateMFAEnrollment(ctx context.Context, userID string, t *time.Time) error AfterCreate( ctx context.Context, user *user.User, identities []*identity.Info, authenticators []*authenticator.Info, isAdminAPI bool, ) error }
type VerificationService ¶
type VerificationService interface { NewVerifiedClaim(ctx context.Context, userID string, claimName string, claimValue string) *verification.Claim GetClaimStatus(ctx context.Context, userID string, claimName model.ClaimName, claimValue string) (*verification.ClaimStatus, error) GetIdentityVerificationStatus(ctx context.Context, i *identity.Info) ([]verification.ClaimStatus, error) MarkClaimVerified(ctx context.Context, claim *verification.Claim) error }
type WebsocketEventStore ¶
type WebsocketEventStore struct { AppID config.AppID RedisHandle *appredis.Handle Store Store // contains filtered or unexported fields }
func NewWebsocketEventStore ¶
func (*WebsocketEventStore) ChannelName ¶
func (s *WebsocketEventStore) ChannelName(websocketChannelName string) string
Source Files ¶
- accept.go
- allowlist.go
- authenticationinfo.go
- clone.go
- context.go
- cookie.go
- dependencies.go
- deps.go
- effect.go
- errors.go
- event.go
- flow.go
- id.go
- independent_inputs.go
- input.go
- intent.go
- intl_middleware.go
- jsonpointer.go
- marshal.go
- milestone.go
- node.go
- output.go
- rate_limit_middleware.go
- service.go
- session.go
- session_bot_protection.go
- store.go
- target_step.go
- traverse.go
- websocket.go
- workflow.go
- workflows.go