Documentation ¶
Index ¶
- Variables
- func NewPasswordNode(name string, autocomplete node.UiNodeInputAttributeAutocomplete) *node.Node
- type DefaultPasswordValidator
- type Strategy
- func (s *Strategy) CompletedAuthenticationMethod(_ context.Context) session.AuthenticationMethod
- func (s *Strategy) CountActiveFirstFactorCredentials(ctx context.Context, cc map[identity.CredentialsType]identity.Credentials) (count int, err error)
- func (s *Strategy) CountActiveMultiFactorCredentials(_ context.Context, _ map[identity.CredentialsType]identity.Credentials) (count int, err error)
- func (s *Strategy) ID() identity.CredentialsType
- func (s *Strategy) Login(w http.ResponseWriter, r *http.Request, f *login.Flow, _ *session.Session) (i *identity.Identity, err error)
- func (s *Strategy) NodeGroup() node.UiNodeGroup
- func (s *Strategy) PopulateLoginMethodFirstFactor(r *http.Request, sr *login.Flow) error
- func (s *Strategy) PopulateLoginMethodFirstFactorRefresh(r *http.Request, sr *login.Flow) (err error)
- func (s *Strategy) PopulateLoginMethodIdentifierFirstCredentials(r *http.Request, sr *login.Flow, opts ...login.FormHydratorModifier) (err error)
- func (s *Strategy) PopulateLoginMethodIdentifierFirstIdentification(r *http.Request, sr *login.Flow) error
- func (s *Strategy) PopulateLoginMethodSecondFactor(r *http.Request, sr *login.Flow) error
- func (s *Strategy) PopulateLoginMethodSecondFactorRefresh(r *http.Request, sr *login.Flow) error
- func (s *Strategy) PopulateRegistrationMethod(r *http.Request, f *registration.Flow) error
- func (s *Strategy) PopulateSettingsMethod(r *http.Request, _ *identity.Identity, f *settings.Flow) error
- func (s *Strategy) Register(_ http.ResponseWriter, r *http.Request, f *registration.Flow, ...) (err error)
- func (s *Strategy) RegisterLoginRoutes(r *x.RouterPublic)
- func (s *Strategy) RegisterRegistrationRoutes(*x.RouterPublic)
- func (s *Strategy) RegisterSettingsRoutes(_ *x.RouterPublic)
- func (s *Strategy) Settings(w http.ResponseWriter, r *http.Request, f *settings.Flow, ss *session.Session) (_ *settings.UpdateContext, err error)
- func (s *Strategy) SettingsStrategyID() string
- type UpdateRegistrationFlowWithPasswordMethod
- type ValidationProvider
- type Validator
Constants ¶
This section is empty.
Variables ¶
var ( ErrNetworkFailure = stderrs.New("unable to check if password has been leaked because an unexpected network error occurred") ErrUnexpectedStatusCode = stderrs.New("unexpected status code") )
Functions ¶
func NewPasswordNode ¶
func NewPasswordNode(name string, autocomplete node.UiNodeInputAttributeAutocomplete) *node.Node
Types ¶
type DefaultPasswordValidator ¶
type DefaultPasswordValidator struct { Client *retryablehttp.Client // contains filtered or unexported fields }
DefaultPasswordValidator implements Validator. It is based on best practices as defined in the following blog posts:
- https://www.troyhunt.com/passwords-evolved-authentication-guidance-for-the-modern-era/ - https://www.microsoft.com/en-us/research/wp-content/uploads/2016/06/Microsoft_Password_Guidance-1.pdf
Additionally passwords are being checked against Troy Hunt's [haveibeenpwnd](https://haveibeenpwned.com/API/v2#SearchingPwnedPasswordsByRange) service to check if the password has been breached in a previous data leak using k-anonymity.
func NewDefaultPasswordValidatorStrategy ¶
func NewDefaultPasswordValidatorStrategy(reg validatorDependencies) (*DefaultPasswordValidator, error)
type Strategy ¶
type Strategy struct {
// contains filtered or unexported fields
}
func NewStrategy ¶
func (*Strategy) CompletedAuthenticationMethod ¶
func (s *Strategy) CompletedAuthenticationMethod(_ context.Context) session.AuthenticationMethod
func (*Strategy) CountActiveFirstFactorCredentials ¶
func (s *Strategy) CountActiveFirstFactorCredentials(ctx context.Context, cc map[identity.CredentialsType]identity.Credentials) (count int, err error)
func (*Strategy) CountActiveMultiFactorCredentials ¶
func (s *Strategy) CountActiveMultiFactorCredentials(_ context.Context, _ map[identity.CredentialsType]identity.Credentials) (count int, err error)
func (*Strategy) ID ¶
func (s *Strategy) ID() identity.CredentialsType
func (*Strategy) NodeGroup ¶
func (s *Strategy) NodeGroup() node.UiNodeGroup
func (*Strategy) PopulateLoginMethodFirstFactor ¶ added in v1.3.0
func (*Strategy) PopulateLoginMethodFirstFactorRefresh ¶ added in v1.3.0
func (*Strategy) PopulateLoginMethodIdentifierFirstCredentials ¶ added in v1.3.0
func (*Strategy) PopulateLoginMethodIdentifierFirstIdentification ¶ added in v1.3.0
func (*Strategy) PopulateLoginMethodSecondFactor ¶ added in v1.3.0
func (*Strategy) PopulateLoginMethodSecondFactorRefresh ¶ added in v1.3.0
func (*Strategy) PopulateRegistrationMethod ¶
func (*Strategy) PopulateSettingsMethod ¶
func (*Strategy) Register ¶
func (s *Strategy) Register(_ http.ResponseWriter, r *http.Request, f *registration.Flow, i *identity.Identity) (err error)
func (*Strategy) RegisterLoginRoutes ¶
func (s *Strategy) RegisterLoginRoutes(r *x.RouterPublic)
func (*Strategy) RegisterRegistrationRoutes ¶
func (s *Strategy) RegisterRegistrationRoutes(*x.RouterPublic)
func (*Strategy) RegisterSettingsRoutes ¶
func (s *Strategy) RegisterSettingsRoutes(_ *x.RouterPublic)
func (*Strategy) SettingsStrategyID ¶
type UpdateRegistrationFlowWithPasswordMethod ¶ added in v0.11.0
type UpdateRegistrationFlowWithPasswordMethod struct { // Password to sign the user up with // // required: true Password string `json:"password"` // The identity's traits // // required: true Traits json.RawMessage `json:"traits"` // The CSRF Token CSRFToken string `json:"csrf_token"` // Method to use // // This field must be set to `password` when using the password method. // // required: true Method string `json:"method"` // Transient data to pass along to any webhooks // // required: false TransientPayload json.RawMessage `json:"transient_payload,omitempty" form:"transient_payload"` }
Update Registration Flow with Password Method
swagger:model updateRegistrationFlowWithPasswordMethod
type ValidationProvider ¶
type ValidationProvider interface {
PasswordValidator() Validator
}
type Validator ¶
type Validator interface { // Validate returns nil if the password is passing the validation strategy and an error otherwise. If a validation error // occurs, a regular error will be returned. If some other type of error occurs (e.g. HTTP request failed), an error // of type *herodot.DefaultError will be returned. Validate(ctx context.Context, identifier, password string) error }
Validator implements a validation strategy for passwords. One example is that the password has to have at least 6 characters and at least one lower and one uppercase password.