webauthn

package
v0.11.0-alpha.0.pre.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InternalContextKeySessionData = "session_data"
)

Variables

View Source
var ErrNoCredentials = errors.New("required credentials not found")
View Source
var ErrNotEnoughCredentials = &jsonschema.ValidationError{
	Message: "unable to remove this security key because it would lock you out of your account", InstancePtr: "#/webauthn_remove"}

Functions

func NewWebAuthnConnectionInput

func NewWebAuthnConnectionInput() *node.Node

func NewWebAuthnConnectionName

func NewWebAuthnConnectionName() *node.Node

func NewWebAuthnConnectionTrigger

func NewWebAuthnConnectionTrigger(options string) *node.Node

func NewWebAuthnLoginInput

func NewWebAuthnLoginInput() *node.Node

func NewWebAuthnLoginTrigger

func NewWebAuthnLoginTrigger(options string) *node.Node

func NewWebAuthnScript

func NewWebAuthnScript(src string, contents []byte) *node.Node
func NewWebAuthnUnlink(c *Credential) *node.Node

Types

type Authenticator

type Authenticator struct {
	AAGUID       []byte `json:"aaguid"`
	SignCount    uint32 `json:"sign_count"`
	CloneWarning bool   `json:"clone_warning"`
}

type Credential

type Credential struct {
	ID              []byte        `json:"id"`
	PublicKey       []byte        `json:"public_key"`
	AttestationType string        `json:"attestation_type"`
	Authenticator   Authenticator `json:"authenticator"`
	DisplayName     string        `json:"display_name"`
	AddedAt         time.Time     `json:"added_at"`
	IsPasswordless  bool          `json:"is_passwordless"`
}

func CredentialFromWebAuthn

func CredentialFromWebAuthn(credential *webauthn.Credential, isPasswordless bool) *Credential

func (*Credential) ToWebAuthn

func (c *Credential) ToWebAuthn() *webauthn.Credential

type Credentials

type Credentials []Credential

func (Credentials) ToWebAuthn

func (c Credentials) ToWebAuthn() (result []webauthn.Credential)

func (Credentials) ToWebAuthnFiltered

func (c Credentials) ToWebAuthnFiltered(aal identity.AuthenticatorAssuranceLevel) (result []webauthn.Credential)

type CredentialsConfig

type CredentialsConfig struct {
	// List of webauthn credentials.
	Credentials Credentials `json:"credentials"`
	UserHandle  []byte      `json:"user_handle"`
}

CredentialsConfig is the struct that is being used as part of the identity credentials.

type Strategy

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

func NewStrategy

func NewStrategy(d registrationStrategyDependencies) *Strategy

func (*Strategy) CompletedAuthenticationMethod

func (s *Strategy) CompletedAuthenticationMethod(ctx context.Context) session.AuthenticationMethod

func (*Strategy) CountActiveFirstFactorCredentials

func (s *Strategy) CountActiveFirstFactorCredentials(cc map[identity.CredentialsType]identity.Credentials) (count int, err error)

func (*Strategy) CountActiveMultiFactorCredentials

func (s *Strategy) CountActiveMultiFactorCredentials(cc map[identity.CredentialsType]identity.Credentials) (count int, err error)

func (*Strategy) ID

func (*Strategy) Login

func (s *Strategy) Login(w http.ResponseWriter, r *http.Request, f *login.Flow, ss *session.Session) (i *identity.Identity, err error)

func (*Strategy) NodeGroup

func (s *Strategy) NodeGroup() node.UiNodeGroup

func (*Strategy) PopulateLoginMethod

func (s *Strategy) PopulateLoginMethod(r *http.Request, requestedAAL identity.AuthenticatorAssuranceLevel, sr *login.Flow) error

func (*Strategy) PopulateRegistrationMethod

func (s *Strategy) PopulateRegistrationMethod(r *http.Request, f *registration.Flow) error

func (*Strategy) PopulateSettingsMethod

func (s *Strategy) PopulateSettingsMethod(r *http.Request, id *identity.Identity, f *settings.Flow) error

func (*Strategy) Register

func (s *Strategy) Register(w http.ResponseWriter, r *http.Request, f *registration.Flow, i *identity.Identity) (err error)

func (*Strategy) RegisterLoginRoutes

func (s *Strategy) RegisterLoginRoutes(r *x.RouterPublic)

swagger:route GET /.well-known/ory/webauthn.js v0alpha2 getWebAuthnJavaScript

Get WebAuthn JavaScript

This endpoint provides JavaScript which is needed in order to perform WebAuthn login and registration.

If you are building a JavaScript Browser App (e.g. in ReactJS or AngularJS) you will need to load this file:

```html
<script src="https://public-kratos.example.org/.well-known/ory/webauthn.js" type="script" async />
```

More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).

Produces:
- text/javascript

Schemes: http, https

Responses:
  200: webAuthnJavaScript

func (*Strategy) RegisterRegistrationRoutes

func (s *Strategy) RegisterRegistrationRoutes(_ *x.RouterPublic)

func (*Strategy) RegisterSettingsRoutes

func (s *Strategy) RegisterSettingsRoutes(_ *x.RouterPublic)

func (*Strategy) Settings

func (*Strategy) SettingsStrategyID

func (s *Strategy) SettingsStrategyID() string

Jump to

Keyboard shortcuts

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