Documentation ¶
Index ¶
- Constants
- Variables
- func ContinuityKey(id string) string
- func ContinuityOptions(p interface{}, i *identity.Identity) []continuity.ManagerOption
- func GetFlowID(r *http.Request) (uuid.UUID, error)
- func OnUnauthenticated(reg interface{ ... }) func(http.ResponseWriter, *http.Request, httprouter.Params)
- func PostHookPostPersistExecutorNames(e []PostHookPostPersistExecutor) []string
- func PostHookPrePersistExecutorNames(e []PostHookPrePersistExecutor) []string
- func WithCallback(cb func(ctxUpdate *UpdateContext) error) func(o *postSettingsHookOptions)
- type ErrorHandler
- type ErrorHandlerProvider
- type Flow
- func (f *Flow) AddContinueWith(c flow.ContinueWith)
- func (f *Flow) AfterFind(*pop.Connection) error
- func (f *Flow) AfterSave(*pop.Connection) error
- func (f *Flow) AppendTo(src *url.URL) *url.URL
- func (f *Flow) ContinueWith() []flow.ContinueWith
- func (f *Flow) EnsureInternalContext()
- func (f *Flow) GetFlowName() flow.FlowName
- func (f Flow) GetID() uuid.UUID
- func (f Flow) GetNID() uuid.UUID
- func (f *Flow) GetRequestURL() string
- func (f *Flow) GetState() State
- func (t *Flow) GetTransientPayload() json.RawMessage
- func (f *Flow) GetType() flow.Type
- func (f *Flow) GetUI() *container.Container
- func (f Flow) MarshalJSON() ([]byte, error)
- func (f *Flow) SetReturnTo()
- func (f *Flow) SetState(state State)
- func (f Flow) TableName(ctx context.Context) string
- func (f *Flow) ToLoggerField() map[string]interface{}
- func (f *Flow) Valid(s *session.Session) error
- type FlowNeedsReAuth
- type FlowPersistenceProvider
- type FlowPersister
- type Handler
- func (h *Handler) FromOldFlow(w http.ResponseWriter, r *http.Request, i *identity.Identity, of Flow) (*Flow, error)
- func (h *Handler) NewFlow(w http.ResponseWriter, r *http.Request, i *identity.Identity, ft flow.Type) (*Flow, error)
- func (h *Handler) RegisterAdminRoutes(admin *x.RouterAdmin)
- func (h *Handler) RegisterPublicRoutes(public *x.RouterPublic)
- type HandlerProvider
- type HookExecutor
- type HookExecutorProvider
- type HooksProvider
- type PostHookPostPersistExecutor
- type PostHookPostPersistExecutorFunc
- type PostHookPrePersistExecutor
- type PostHookPrePersistExecutorFunc
- type PostSettingsHookOption
- type PreHookExecutor
- type PreHookExecutorFunc
- type State
- type Strategies
- type Strategy
- type StrategyProvider
- type UpdateContext
- type UpdatePayload
Constants ¶
View Source
const ( RouteInitBrowserFlow = "/self-service/settings/browser" RouteInitAPIFlow = "/self-service/settings/api" RouteGetFlow = "/self-service/settings/flows" RouteSubmitFlow = "/self-service/settings" ContinuityPrefix = "ory_kratos_settings" )
View Source
const (
StrategyProfile = "profile"
)
Variables ¶
View Source
var (
ErrContinuePreviousAction = errors.New("found prior action")
)
View Source
var ErrHookAbortFlow = errors.New("aborted settings hook execution")
Functions ¶
func ContinuityKey ¶
func ContinuityOptions ¶
func ContinuityOptions(p interface{}, i *identity.Identity) []continuity.ManagerOption
func OnUnauthenticated ¶
func OnUnauthenticated(reg interface { config.Provider x.WriterProvider }) func(http.ResponseWriter, *http.Request, httprouter.Params)
func PostHookPostPersistExecutorNames ¶
func PostHookPostPersistExecutorNames(e []PostHookPostPersistExecutor) []string
func PostHookPrePersistExecutorNames ¶
func PostHookPrePersistExecutorNames(e []PostHookPrePersistExecutor) []string
func WithCallback ¶
func WithCallback(cb func(ctxUpdate *UpdateContext) error) func(o *postSettingsHookOptions)
Types ¶
type ErrorHandler ¶
type ErrorHandler struct {
// contains filtered or unexported fields
}
func NewErrorHandler ¶
func NewErrorHandler(d errorHandlerDependencies) *ErrorHandler
func (*ErrorHandler) PrepareReplacementForExpiredFlow ¶
func (s *ErrorHandler) PrepareReplacementForExpiredFlow(w http.ResponseWriter, r *http.Request, f *Flow, id *identity.Identity, err error) (*flow.ExpiredError, error)
func (*ErrorHandler) WriteFlowError ¶
func (s *ErrorHandler) WriteFlowError( w http.ResponseWriter, r *http.Request, group node.UiNodeGroup, f *Flow, id *identity.Identity, err error, )
type ErrorHandlerProvider ¶
type ErrorHandlerProvider interface{ SettingsFlowErrorHandler() *ErrorHandler }
type Flow ¶
type Flow struct { // ID represents the flow's unique ID. When performing the settings flow, this // represents the id in the settings ui's query parameter: http://<selfservice.flows.settings.ui_url>?flow=<id> // // required: true // type: string // format: uuid ID uuid.UUID `json:"id" db:"id" faker:"-"` // Type represents the flow's type which can be either "api" or "browser", depending on the flow interaction. // // required: true Type flow.Type `json:"type" db:"type" faker:"flow_type"` // ExpiresAt is the time (UTC) when the flow expires. If the user still wishes to update the setting, // a new flow has to be initiated. // // required: true ExpiresAt time.Time `json:"expires_at" faker:"time_type" db:"expires_at"` // IssuedAt is the time (UTC) when the flow occurred. // // required: true IssuedAt time.Time `json:"issued_at" faker:"time_type" db:"issued_at"` // RequestURL is the initial URL that was requested from Ory Kratos. It can be used // to forward information contained in the URL's path or query for example. // // required: true RequestURL string `json:"request_url" db:"request_url"` // ReturnTo contains the requested return_to URL. ReturnTo string `json:"return_to,omitempty" db:"-"` // Active, if set, contains the registration method that is being used. It is initially // not set. Active sqlxx.NullString `json:"active,omitempty" db:"active_method"` // UI contains data which must be shown in the user interface. // // required: true UI *container.Container `json:"ui" db:"ui"` // Identity contains the identity's data in raw form. // // If `state` is `success` this will be the updated identity! // // required: true Identity *identity.Identity `json:"identity" faker:"identity" db:"-" belongs_to:"identities" fk_id:"IdentityID"` // State represents the state of this flow. It knows two states: // // - show_form: No user data has been collected, or it is invalid, and thus the form should be shown. // - success: Indicates that the settings flow has been updated successfully with the provided data. // Done will stay true when repeatedly checking. If set to true, done will revert back to false only // when a flow with invalid (e.g. "please use a valid phone number") data was sent. // // required: true State State `json:"state" faker:"-" db:"state"` // InternalContext stores internal context used by internals - for example MFA keys. InternalContext sqlxx.JSONRawMessage `db:"internal_context" json:"-" faker:"-"` // IdentityID is a helper struct field for gobuffalo.pop. IdentityID uuid.UUID `json:"-" faker:"-" db:"identity_id"` // CreatedAt is a helper struct field for gobuffalo.pop. CreatedAt time.Time `json:"-" faker:"-" db:"created_at"` // UpdatedAt is a helper struct field for gobuffalo.pop. UpdatedAt time.Time `json:"-" faker:"-" db:"updated_at"` NID uuid.UUID `json:"-" faker:"-" db:"nid"` // Contains a list of actions, that could follow this flow // // It can, for example, contain a reference to the verification flow, created as part of the user's // registration. // // required: false ContinueWithItems []flow.ContinueWith `json:"continue_with,omitempty" db:"-" faker:"-" ` // TransientPayload is used to pass data from the settings flow to hooks and email templates // // required: false TransientPayload json.RawMessage `json:"transient_payload,omitempty" faker:"-" db:"-"` }
Flow represents a Settings Flow
This flow is used when an identity wants to update settings (e.g. profile data, passwords, ...) in a selfservice manner.
We recommend reading the [User Settings Documentation](../self-service/flows/user-settings)
swagger:model settingsFlow
func MustNewFlow ¶
func (*Flow) AddContinueWith ¶ added in v0.13.0
func (f *Flow) AddContinueWith(c flow.ContinueWith)
func (*Flow) ContinueWith ¶ added in v0.13.0
func (f *Flow) ContinueWith() []flow.ContinueWith
func (*Flow) EnsureInternalContext ¶
func (f *Flow) EnsureInternalContext()
func (*Flow) GetFlowName ¶ added in v1.1.0
func (*Flow) GetRequestURL ¶
func (*Flow) GetTransientPayload ¶ added in v1.2.0
func (t *Flow) GetTransientPayload() json.RawMessage
func (Flow) MarshalJSON ¶
func (*Flow) SetReturnTo ¶
func (f *Flow) SetReturnTo()
func (*Flow) ToLoggerField ¶ added in v1.3.0
type FlowNeedsReAuth ¶
type FlowNeedsReAuth struct { *herodot.DefaultError `json:"error"` // Points to where to redirect the user to next. RedirectBrowserTo string `json:"redirect_browser_to"` }
FlowNeedsReAuth is sent when a privileged session is required to perform the settings update.
func NewFlowNeedsReAuth ¶
func NewFlowNeedsReAuth() *FlowNeedsReAuth
func (*FlowNeedsReAuth) EnhanceJSONError ¶
func (e *FlowNeedsReAuth) EnhanceJSONError() interface{}
type FlowPersistenceProvider ¶
type FlowPersistenceProvider interface {
SettingsFlowPersister() FlowPersister
}
type FlowPersister ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(d handlerDependencies) *Handler
func (*Handler) FromOldFlow ¶
func (*Handler) RegisterAdminRoutes ¶
func (h *Handler) RegisterAdminRoutes(admin *x.RouterAdmin)
func (*Handler) RegisterPublicRoutes ¶
func (h *Handler) RegisterPublicRoutes(public *x.RouterPublic)
type HandlerProvider ¶
type HandlerProvider interface {
SettingsHandler() *Handler
}
type HookExecutor ¶
type HookExecutor struct {
// contains filtered or unexported fields
}
func NewHookExecutor ¶
func NewHookExecutor(d executorDependencies) *HookExecutor
func (*HookExecutor) PostSettingsHook ¶
func (e *HookExecutor) PostSettingsHook(w http.ResponseWriter, r *http.Request, settingsType string, ctxUpdate *UpdateContext, i *identity.Identity, opts ...PostSettingsHookOption) error
func (*HookExecutor) PreSettingsHook ¶ added in v0.11.0
func (e *HookExecutor) PreSettingsHook(w http.ResponseWriter, r *http.Request, a *Flow) error
type HookExecutorProvider ¶
type HookExecutorProvider interface {
SettingsHookExecutor() *HookExecutor
}
type HooksProvider ¶
type HooksProvider interface { PreSettingsHooks(ctx context.Context) []PreHookExecutor PostSettingsPrePersistHooks(ctx context.Context, settingsType string) []PostHookPrePersistExecutor PostSettingsPostPersistHooks(ctx context.Context, settingsType string) []PostHookPostPersistExecutor }
type PostHookPostPersistExecutorFunc ¶
type PostHookPostPersistExecutorFunc func(w http.ResponseWriter, r *http.Request, a *Flow, id *identity.Identity, s *session.Session) error
func (PostHookPostPersistExecutorFunc) ExecuteSettingsPostPersistHook ¶
type PostHookPrePersistExecutorFunc ¶
type PostHookPrePersistExecutorFunc func(w http.ResponseWriter, r *http.Request, a *Flow, s *identity.Identity) error
func (PostHookPrePersistExecutorFunc) ExecuteSettingsPrePersistHook ¶
func (f PostHookPrePersistExecutorFunc) ExecuteSettingsPrePersistHook(w http.ResponseWriter, r *http.Request, a *Flow, s *identity.Identity) error
type PostSettingsHookOption ¶
type PostSettingsHookOption func(o *postSettingsHookOptions)
type PreHookExecutor ¶ added in v0.11.0
type PreHookExecutorFunc ¶ added in v0.11.0
func (PreHookExecutorFunc) ExecuteSettingsPreHook ¶ added in v0.11.0
func (f PreHookExecutorFunc) ExecuteSettingsPreHook(w http.ResponseWriter, r *http.Request, a *Flow) error
type State ¶
State represents the state of this flow. It knows two states:
- show_form: No user data has been collected, or it is invalid, and thus the form should be shown.
- success: Indicates that the settings flow has been updated successfully with the provided data. Done will stay true when repeatedly checking. If set to true, done will revert back to false only when a flow with invalid (e.g. "please use a valid phone number") data was sent.
swagger:model settingsFlowState
type Strategies ¶
type Strategies []Strategy
func (Strategies) MustStrategy ¶
func (s Strategies) MustStrategy(id string) Strategy
func (Strategies) RegisterPublicRoutes ¶
func (s Strategies) RegisterPublicRoutes(r *x.RouterPublic)
type Strategy ¶
type Strategy interface { SettingsStrategyID() string NodeGroup() node.UiNodeGroup RegisterSettingsRoutes(*x.RouterPublic) PopulateSettingsMethod(*http.Request, *identity.Identity, *Flow) error Settings(w http.ResponseWriter, r *http.Request, f *Flow, s *session.Session) (*UpdateContext, error) }
type StrategyProvider ¶
type StrategyProvider interface { SettingsStrategies(ctx context.Context) Strategies AllSettingsStrategies() Strategies }
type UpdateContext ¶
type UpdateContext struct { Session *session.Session Flow *Flow // contains filtered or unexported fields }
func PrepareUpdate ¶
func PrepareUpdate(d interface { x.LoggingProvider continuity.ManagementProvider }, w http.ResponseWriter, r *http.Request, f *Flow, ss *session.Session, name string, payload UpdatePayload) (*UpdateContext, error)
func (*UpdateContext) GetIdentityToUpdate ¶
func (c *UpdateContext) GetIdentityToUpdate() (*identity.Identity, error)
func (UpdateContext) GetSessionIdentity ¶
func (c UpdateContext) GetSessionIdentity() *identity.Identity
func (*UpdateContext) UpdateIdentity ¶
func (c *UpdateContext) UpdateIdentity(i *identity.Identity)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.