Documentation ¶
Index ¶
- func NewService(options ...ConfigOption) (auth.WebAuthnService, error)
- type ConfigOption
- type Rediser
- type User
- type WebAuthn
- func (w *WebAuthn) BeginLogin(ctx context.Context, user *auth.User) ([]byte, error)
- func (w *WebAuthn) BeginSignUp(ctx context.Context, user *auth.User) ([]byte, error)
- func (w *WebAuthn) FinishLogin(ctx context.Context, user *auth.User, r *http.Request) error
- func (w *WebAuthn) FinishSignUp(ctx context.Context, user *auth.User, r *http.Request) (*auth.Device, error)
- type Webauthner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewService ¶
func NewService(options ...ConfigOption) (auth.WebAuthnService, error)
NewService returns a new WebAuthn validator.
Types ¶
type ConfigOption ¶
type ConfigOption func(*WebAuthn)
ConfigOption configures the validator.
func WithDisplayName ¶
func WithDisplayName(name string) ConfigOption
WithDisplayName configures the validator with a display name.
func WithDomain ¶
func WithDomain(domain string) ConfigOption
WithDomain configures the validator with a domain name.
func WithRepoManager ¶
func WithRepoManager(repoMngr auth.RepositoryManager) ConfigOption
WithRepoManager configures the service with a new RepositoryManager.
func WithRequestOrigin ¶
func WithRequestOrigin(origin string) ConfigOption
WithRequestOrigin configures the validator with a request origin.
type Rediser ¶
type Rediser interface { Get(key string) *redis.StringCmd Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd WithContext(ctx context.Context) *redis.Client Close() error }
Rediser is an interface to go-redis.
type User ¶
User is a wrapper for the authenticator domain entity auth.User to allow compatibility with duo-lab's webauthn User interface.
func (*User) WebAuthnCredentials ¶
func (u *User) WebAuthnCredentials() []webauthnLib.Credential
WebAuthnCredentials returns all of the user's Devices.
func (*User) WebAuthnDisplayName ¶
WebAuthnDisplayName returns the User's display name.
func (*User) WebAuthnIcon ¶
WebAuthnIcon returns an Icon for the user.
func (*User) WebAuthnName ¶
WebAuthnName returns the User's name.
type WebAuthn ¶
type WebAuthn struct {
// contains filtered or unexported fields
}
WebAuthn is a implements the WebAuthn authentication protocol. Under the hood it defers the actual validation to the /duo-labs/webauthn library and wraps the service's domain entities to provide compatibility with the third party library.
func (*WebAuthn) BeginLogin ¶
BeginLogin attempts to authenticate a user through device ownership.
func (*WebAuthn) BeginSignUp ¶
BeginSignUp attempts to register a new WebAuthn capable device for a user.
func (*WebAuthn) FinishLogin ¶
FinishLogin determines if a user successfully proved ownership of their device, thereby asserting their identity.
type Webauthner ¶
type Webauthner interface { BeginRegistration(user webauthnLib.User, opts ...webauthnLib.RegistrationOption) (*webauthnProto.CredentialCreation, *webauthnLib.SessionData, error) FinishRegistration(user webauthnLib.User, session webauthnLib.SessionData, r *http.Request) (*webauthnLib.Credential, error) BeginLogin(user webauthnLib.User, opts ...webauthnLib.LoginOption) (*webauthnProto.CredentialAssertion, *webauthnLib.SessionData, error) FinishLogin(user webauthnLib.User, session webauthnLib.SessionData, r *http.Request) (*webauthnLib.Credential, error) }
Webauthner is an interface to duo-labs/webauthn