profile

package
v0.0.3-alpha.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PublicProfileManagementPath        = "/self-service/browser/flows/profile"
	PublicProfileManagementRequestPath = "/self-service/browser/flows/requests/profile"
	AdminBrowserProfileRequestPath     = "/self-service/browser/flows/requests/profile"
	PublicProfileManagementUpdatePath  = "/self-service/browser/flows/profile/update"
)

Variables

View Source
var (
	ErrRequestExpired = herodot.ErrBadRequest.
		WithError("profile management request expired").
		WithReasonf(`The profile management request has expired. Please restart the flow.`)
)

Functions

func TestRequestPersister

func TestRequestPersister(p interface {
	RequestPersister
	identity.Pool
}) func(t *testing.T)

Types

type ErrorHandler

type ErrorHandler struct {
	// contains filtered or unexported fields
}

func NewErrorHandler

func NewErrorHandler(d errorHandlerDependencies, c configuration.Provider) *ErrorHandler

func (*ErrorHandler) HandleProfileManagementError

func (s *ErrorHandler) HandleProfileManagementError(
	w http.ResponseWriter,
	r *http.Request,
	ct identity.CredentialsType,
	rr *Request,
	err error,
)

type ErrorHandlerProvider

type ErrorHandlerProvider interface{ ProfileRequestRequestErrorHandler() *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 {
	ProfileManagementHandler() *Handler
}

type Request

type Request struct {
	// ID represents the request's unique ID. When performing the profile management flow, this
	// represents the id in the profile ui's query parameter: http://<urls.profile_ui>?request=<id>
	//
	// 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 profile,
	// a new request has to be initiated.
	ExpiresAt time.Time `json:"expires_at" faker:"time_type" db:"expires_at"`

	// IssuedAt is the time (UTC) when the request occurred.
	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.
	RequestURL string `json:"request_url" db:"request_url"`

	// Form contains form fields, errors, and so on.
	Form *form.HTMLForm `json:"form" db:"form"`

	// Identity contains all of the identity's data in raw form.
	Identity *identity.Identity `json:"identity" faker:"identity" db:"-" belongs_to:"identities" fk_id:"IdentityID"`

	// UpdateSuccessful, if true, indicates that the profile 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.
	UpdateSuccessful bool `json:"update_successful,omitempty" 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 profile management request

This request is used when an identity wants to update profile information (especially traits) in a selfservice manner.

For more information head over to: https://www.ory.sh/docs/kratos/selfservice/profile

swagger:model profileManagementRequest

func NewRequest

func NewRequest(exp time.Duration, r *http.Request, s *session.Session) *Request

func (*Request) TableName

func (r *Request) TableName() string

func (*Request) Valid

func (r *Request) Valid(s *session.Session) error

type RequestPersistenceProvider

type RequestPersistenceProvider interface {
	ProfileRequestPersister() RequestPersister
}

type RequestPersister

type RequestPersister interface {
	CreateProfileRequest(context.Context, *Request) error
	GetProfileRequest(ctx context.Context, id uuid.UUID) (*Request, error)
	UpdateProfileRequest(context.Context, *Request) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL