strategy

package
v0.8.27 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PasskeyAuthMethod   string = "passkey"
	PasskeyRegisterType string = "register"
	PasskeyLoginType    string = "login"
)
View Source
const (
	MailLinkAuthMethod string = "maillink"
)
View Source
const (
	MailOTPAuthMethod string = "mailotp"
)

Variables

This section is empty.

Functions

func EmbedFlowInOIDCState

func EmbedFlowInOIDCState(param string) (string, error)

func ExtractFlowFromOIDCState

func ExtractFlowFromOIDCState(state string) (string, error)

func GenerateNonceFromLetters

func GenerateNonceFromLetters(length int, letterRunes []rune) string

Types

type MailLink struct {
	Now func() time.Time
	// contains filtered or unexported fields
}

MailLink sends a mail with a one time password link to user's email id. On successful verification, it creates a session

func NewMailLink(d mailer.Dialer, host, subject, body string) *MailLink

func (MailLink) SendMail added in v0.7.2

func (m MailLink) SendMail(id, to string) (string, error)

SendMail sends a mail with a one time password embedded link to user's email id

type MailOTP

type MailOTP struct {
	Now func() time.Time
	// contains filtered or unexported fields
}

MailOTP sends a mail with a one time password to user's email id and verifies the OTP. On successful verification, it creates a session

func NewMailOTP added in v0.7.2

func NewMailOTP(d mailer.Dialer, subject, body string) *MailOTP

func (MailOTP) SendMail

func (m MailOTP) SendMail(to string) (string, error)

SendMail sends a mail with a one time password embedded link to user's email id

type OIDC

type OIDC struct {
	Client *http.Client
	// contains filtered or unexported fields
}

func NewRelyingPartyOIDC

func NewRelyingPartyOIDC(clientId string, clientSecret string, redirectUrl string) *OIDC

func (*OIDC) AuthURL

func (g *OIDC) AuthURL(state string) (url string, nonce string, err error)

func (*OIDC) GetUser

func (g *OIDC) GetUser(ctx context.Context, token *oauth2.Token) (*UserInfo, error)

func (*OIDC) Init

func (g *OIDC) Init(ctx context.Context, issuer string) (*OIDC, error)

func (*OIDC) Token

func (g *OIDC) Token(ctx context.Context, code string, nonce string) (*oauth2.Token, error)

Token exchange auth code with token and verifies that an *oauth2.Token is a valid *oidc.IDToken it matches nonce from *oidc.IDToken with flow nonce

type UserData added in v0.7.14

type UserData struct {
	Id          string
	Name        string
	DisplayName string
	Credentials []webauthn.Credential
}

func NewPassKeyUser added in v0.7.14

func NewPassKeyUser(id string) *UserData

func NewPasskeyUserWithCredentials added in v0.7.14

func NewPasskeyUserWithCredentials(id string, webAuthCredentialData []webauthn.Credential) *UserData

func (*UserData) WebAuthnCredentials added in v0.7.14

func (u *UserData) WebAuthnCredentials() []webauthn.Credential

func (*UserData) WebAuthnDisplayName added in v0.7.14

func (u *UserData) WebAuthnDisplayName() string

func (*UserData) WebAuthnID added in v0.7.14

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

func (*UserData) WebAuthnIcon added in v0.7.14

func (u *UserData) WebAuthnIcon() string

func (*UserData) WebAuthnName added in v0.7.14

func (u *UserData) WebAuthnName() string

type UserInfo

type UserInfo struct {
	Name  string
	Email string
}

Jump to

Keyboard shortcuts

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