strategy

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

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 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