Documentation ¶
Index ¶
- Constants
- Variables
- func ContinuityKey(id string) string
- func ContinuityOptions(p interface{}, i *identity.Identity) []continuity.ManagerOption
- func GetRequestID(r *http.Request) (uuid.UUID, error)
- func TestRequestPersister(p interface{ ... }) func(t *testing.T)
- func WithCallback(cb func(ctxUpdate *UpdateContext) error) func(o *postSettingsHookOptions)
- type ErrorHandler
- type ErrorHandlerProvider
- type Handler
- type HandlerProvider
- type HookExecutor
- type HookExecutorProvider
- type HooksProvider
- type PostHookPostPersistExecutor
- type PostHookPostPersistExecutorFunc
- type PostHookPrePersistExecutor
- type PostHookPrePersistExecutorFunc
- type PostSettingsHookOption
- type Request
- type RequestForms
- type RequestMethod
- type RequestMethodConfig
- type RequestMethodConfigurator
- type RequestMethodsRaw
- type RequestPersistenceProvider
- type RequestPersister
- type Strategies
- type Strategy
- type StrategyProvider
- type StrategyTraits
- type TraitsRequestMethod
- type UpdateContext
- type UpdatePayload
Constants ¶
View Source
const ( PublicPath = "/self-service/browser/flows/settings" PublicRequestPath = "/self-service/browser/flows/requests/settings" )
View Source
const ( StrategyProfile = "profile" PublicSettingsProfilePath = "/self-service/browser/flows/settings/strategies/profile" ContinuityPrefix = "ory_kratos_settings" )
Variables ¶
View Source
var ( ErrRequestExpired = herodot.ErrBadRequest. WithError("settings request expired"). WithReasonf(`The settings request has expired. Please restart the flow.`) ErrHookAbortRequest = errors.New("aborted settings hook execution") ErrRequestNeedsReAuthentication = herodot.ErrForbidden.WithReasonf("The login session is too old and thus not allowed to update these fields. Please re-authenticate.") )
View Source
var (
ErrContinuePreviousAction = errors.New("found prior action")
)
Functions ¶
func ContinuityKey ¶
func ContinuityOptions ¶
func ContinuityOptions(p interface{}, i *identity.Identity) []continuity.ManagerOption
func TestRequestPersister ¶
func TestRequestPersister(p interface { RequestPersister identity.PrivilegedPool }) func(t *testing.T)
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, c configuration.Provider) *ErrorHandler
func (*ErrorHandler) HandleSettingsError ¶
func (s *ErrorHandler) HandleSettingsError( w http.ResponseWriter, r *http.Request, rr *Request, err error, method string, )
type ErrorHandlerProvider ¶
type ErrorHandlerProvider interface{ SettingsRequestErrorHandler() *ErrorHandler }
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(d handlerDependencies, c configuration.Provider) *Handler
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, c configuration.Provider, ) *HookExecutor
func (*HookExecutor) PostSettingsHook ¶
func (e *HookExecutor) PostSettingsHook(w http.ResponseWriter, r *http.Request, settingsType string, ctxUpdate *UpdateContext, i *identity.Identity, opts ...PostSettingsHookOption) error
type HookExecutorProvider ¶
type HookExecutorProvider interface {
SettingsHookExecutor() *HookExecutor
}
type HooksProvider ¶
type HooksProvider interface { PostSettingsPrePersistHooks(settingsType string) []PostHookPrePersistExecutor PostSettingsPostPersistHooks(settingsType string) []PostHookPostPersistExecutor }
type PostHookPostPersistExecutorFunc ¶
type PostHookPostPersistExecutorFunc func(w http.ResponseWriter, r *http.Request, a *Request, s *identity.Identity) error
func (PostHookPostPersistExecutorFunc) ExecuteSettingsPostPersistHook ¶
func (f PostHookPostPersistExecutorFunc) ExecuteSettingsPostPersistHook(w http.ResponseWriter, r *http.Request, a *Request, s *identity.Identity) error
type PostHookPrePersistExecutorFunc ¶
type PostHookPrePersistExecutorFunc func(w http.ResponseWriter, r *http.Request, a *Request, s *identity.Identity) error
func (PostHookPrePersistExecutorFunc) ExecuteSettingsPrePersistHook ¶
func (f PostHookPrePersistExecutorFunc) ExecuteSettingsPrePersistHook(w http.ResponseWriter, r *http.Request, a *Request, s *identity.Identity) error
type PostSettingsHookOption ¶
type PostSettingsHookOption func(o *postSettingsHookOptions)
type Request ¶
type Request struct { // ID represents the request's unique ID. When performing the settings flow, this // represents the id in the settings ui's query parameter: http://<urls.settings_ui>?request=<id> // // required: true // type: string // format: uuid ID uuid.UUID `json:"id" db:"id" faker:"uuid" rw:"r"` // ExpiresAt is the time (UTC) when the request expires. If the user still wishes to update the setting, // a new request 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 request 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"` // 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"` // Methods contains context for all enabled registration methods. If a registration request has been // processed, but for example the password is incorrect, this will contain error messages. // // required: true Methods map[string]*RequestMethod `json:"methods" faker:"settings_request_methods" db:"-"` // MethodsRaw is a helper struct field for gobuffalo.pop. MethodsRaw RequestMethodsRaw `json:"-" faker:"-" has_many:"selfservice_settings_request_methods" fk_id:"selfservice_settings_request_id"` // Identity contains all of the identity's data in raw form. // // required: true Identity *identity.Identity `json:"identity" faker:"identity" db:"-" belongs_to:"identities" fk_id:"IdentityID"` // UpdateSuccessful, if true, indicates that the settings request 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 request with invalid (e.g. "please use a valid phone number") data was sent. // // required: true UpdateSuccessful bool `json:"update_successful" faker:"-" db:"update_successful"` // 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"` }
Request presents a settings request
This request 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 settingsRequest
func (*Request) BeforeSave ¶
type RequestForms ¶
type RequestForms map[string]*RequestMethod
func (RequestForms) TableName ¶
func (u RequestForms) TableName() string
type RequestMethod ¶
type RequestMethod struct { // Method contains the request credentials type. Method string `json:"method" db:"method"` // Config is the credential type's config. Config *RequestMethodConfig `json:"config" db:"config"` // ID is a helper struct field for gobuffalo.pop. ID uuid.UUID `json:"-" db:"id" rw:"r"` // RequestID is a helper struct field for gobuffalo.pop. RequestID uuid.UUID `json:"-" db:"selfservice_settings_request_id"` // Request is a helper struct field for gobuffalo.pop. Request *Request `json:"-" belongs_to:"selfservice_settings_request" fk_id:"RequestID"` // CreatedAt is a helper struct field for gobuffalo.pop. CreatedAt time.Time `json:"-" db:"created_at"` // UpdatedAt is a helper struct field for gobuffalo.pop. UpdatedAt time.Time `json:"-" db:"updated_at"` }
swagger:model settingsRequestMethod
func (RequestMethod) TableName ¶
func (u RequestMethod) TableName() string
type RequestMethodConfig ¶
type RequestMethodConfig struct { // swagger:ignore RequestMethodConfigurator // contains filtered or unexported fields }
swagger:type settingsRequestConfigPayload
func (*RequestMethodConfig) MarshalJSON ¶
func (c *RequestMethodConfig) MarshalJSON() ([]byte, error)
func (*RequestMethodConfig) Scan ¶
func (c *RequestMethodConfig) Scan(value interface{}) error
func (*RequestMethodConfig) UnmarshalJSON ¶
func (c *RequestMethodConfig) UnmarshalJSON(data []byte) error
type RequestMethodConfigurator ¶
type RequestMethodConfigurator interface { form.ErrorParser form.FieldSetter form.FieldUnsetter form.ValueSetter form.Resetter form.ErrorResetter form.CSRFSetter form.FieldSorter form.ErrorAdder }
swagger:ignore
type RequestMethodsRaw ¶
type RequestMethodsRaw []RequestMethod // workaround for https://github.com/gobuffalo/pop/pull/478
func (RequestMethodsRaw) TableName ¶
func (u RequestMethodsRaw) TableName() string
type RequestPersistenceProvider ¶
type RequestPersistenceProvider interface {
SettingsRequestPersister() RequestPersister
}
type RequestPersister ¶
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 StrategyProvider ¶
type StrategyProvider interface {
SettingsStrategies() Strategies
}
type StrategyTraits ¶
type StrategyTraits struct {
// contains filtered or unexported fields
}
func NewStrategyTraits ¶
func NewStrategyTraits(d strategyDependencies, c configuration.Provider) *StrategyTraits
func (*StrategyTraits) PopulateSettingsMethod ¶
func (*StrategyTraits) RegisterSettingsRoutes ¶
func (s *StrategyTraits) RegisterSettingsRoutes(public *x.RouterPublic)
func (*StrategyTraits) SettingsStrategyID ¶
func (s *StrategyTraits) SettingsStrategyID() string
type TraitsRequestMethod ¶
swagger:model traitsFormConfig
type UpdateContext ¶
func PrepareUpdate ¶
func PrepareUpdate(d interface { x.LoggingProvider continuity.ManagementProvider session.ManagementProvider RequestPersistenceProvider }, w http.ResponseWriter, r *http.Request, name string, payload UpdatePayload) (*UpdateContext, error)
Click to show internal directories.
Click to hide internal directories.