webauthn

package
v0.1.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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 WithDB

func WithDB(db Rediser) ConfigOption

WithDB configures the service with a redis DB

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

type User struct {
	*auth.User
	Devices []*auth.Device
}

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

func (u *User) WebAuthnDisplayName() string

WebAuthnDisplayName returns the User's display name.

func (*User) WebAuthnID

func (u *User) WebAuthnID() []byte

WebAuthnID returns the User's ID.

func (*User) WebAuthnIcon

func (u *User) WebAuthnIcon() string

WebAuthnIcon returns an Icon for the user.

func (*User) WebAuthnName

func (u *User) WebAuthnName() string

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

func (w *WebAuthn) BeginLogin(ctx context.Context, user *auth.User) ([]byte, error)

BeginLogin attempts to authenticate a user through device ownership.

func (*WebAuthn) BeginSignUp

func (w *WebAuthn) BeginSignUp(ctx context.Context, user *auth.User) ([]byte, error)

BeginSignUp attempts to register a new WebAuthn capable device for a user.

func (*WebAuthn) FinishLogin

func (w *WebAuthn) FinishLogin(ctx context.Context, user *auth.User, r *http.Request) error

FinishLogin determines if a user successfully proved ownership of their device, thereby asserting their identity.

func (*WebAuthn) FinishSignUp

func (w *WebAuthn) FinishSignUp(ctx context.Context, user *auth.User, r *http.Request) (*auth.Device, error)

FinishSignUp attempts to verify a registration attempt for a new WebAuthn capable device.

type Webauthner

Webauthner is an interface to duo-labs/webauthn

Jump to

Keyboard shortcuts

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