email

package
v0.0.0-...-12da999 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server                    SMTPServer
	From                      string
	MaxAge                    time.Duration
	SendVerificationRequest   func(params VerificationRequestParams) error
	GenerateVerificationToken func() (string, error)
	NormalizeIdentifier       func(identifier string) string
}

type Provider

type Provider struct {
	ClientKey   string
	Secret      string
	CallbackURL string
	HTTPClient  *http.Client
	// contains filtered or unexported fields
}

Provider is the implementation of `goth.Provider` for email authentication.

func New

func New(clientKey, secret, callbackURL string, config *Config) *Provider

New creates a new Email provider

func (*Provider) BeginAuth

func (p *Provider) BeginAuth(state string) (goth.Session, error)

func (*Provider) Client

func (p *Provider) Client() *http.Client

func (*Provider) Debug

func (p *Provider) Debug(debug bool)

func (*Provider) DefaultGenerateVerificationToken

func (p *Provider) DefaultGenerateVerificationToken() (string, error)

func (*Provider) DefaultNormalizeIdentifier

func (p *Provider) DefaultNormalizeIdentifier(identifier string) string

func (*Provider) DefaultSendVerificationRequest

func (p *Provider) DefaultSendVerificationRequest(params VerificationRequestParams) error

func (*Provider) FetchUser

func (p *Provider) FetchUser(session goth.Session) (goth.User, error)

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) RefreshToken

func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error)

func (*Provider) RefreshTokenAvailable

func (p *Provider) RefreshTokenAvailable() bool

func (*Provider) SendVerificationRequest

func (p *Provider) SendVerificationRequest(email, callbackURL string) error

func (*Provider) SetName

func (p *Provider) SetName(name string)

func (*Provider) UnmarshalSession

func (p *Provider) UnmarshalSession(data string) (goth.Session, error)

UnmarshalSession will unmarshal a JSON string into a session.

type SMTPServer

type SMTPServer struct {
	Host string
	Port int
	User string
	Pass string
}

type Session

type Session struct {
	AuthURL string
	Email   string
}

Session stores data during the auth process with Email.

func (*Session) Authorize

func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error)

Authorize the session with Email and return the email address to be stored for future use.

func (Session) GetAuthURL

func (s Session) GetAuthURL() (string, error)

GetAuthURL will return the URL set by calling the `BeginAuth` function on the Email provider.

func (Session) Marshal

func (s Session) Marshal() string

Marshal the session into a string

func (Session) String

func (s Session) String() string

type VerificationRequestParams

type VerificationRequestParams struct {
	Identifier string
	URL        string
	Token      string
	Provider   *Provider
	Expires    time.Time
}

Jump to

Keyboard shortcuts

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