oauth2

package
v0.0.0-...-833fa1d Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 7 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 {
	ProviderName string
	OAuth2       *oauth2.Config
	Extractor    DataExtractor
	StateCode    string
}

Config provides a configuration for oauth2 authentication

func (*Config) LoginURL

func (c *Config) LoginURL(params []elogin.URLParam) string

LoginURL returns the login url

func (*Config) OAuth2Config

func (c *Config) OAuth2Config() *oauth2.Config

OAuth2Config returns the oauth2 configuration

func (*Config) Protocol

func (c *Config) Protocol() string

Protocol returns the protocol name

func (*Config) Provider

func (c *Config) Provider() string

Provider returns the provider name

func (*Config) UserData

func (c *Config) UserData(ctx context.Context, values url.Values, params []elogin.URLParam) (*elogin.Token, *elogin.UserData, error)

UserData returns the user data from the oauth2 token

type DataExtractor

type DataExtractor func(ctx context.Context, token *oauth2.Token, oauth2conf *oauth2.Config) (*elogin.UserData, error)

DataExtractor provides a function to extract user data from oauth2 token

Jump to

Keyboard shortcuts

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