auth

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthCookie                = "auth"
	AccessTokenKey            = "access-token"
	AuthExtrasCookie          = "auth-extras"
	IDTokenKey                = "id-token"
	EmailKey                  = "email"
	NameKey                   = "name"
	PictureKey                = "picture"
	AuthorizationExtrasHeader = "authorization-extras"
)

Variables

This section is empty.

Functions

func GetCurrentUser

func GetCurrentUser(c echo.Context) error

func SetUser

func SetUser(c echo.Context, user *User) error

func ValidateAuth

func ValidateAuth(c echo.Context, cfgProvider *config.ConfigProviderWithRefresh) error

func WithAuth

func WithAuth(c echo.Context) runtime.ServeMuxOption

Types

type Claims

type Claims struct {
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
	Name          string `json:"name"`
	Picture       string `json:"picture"`
}

type IDToken added in v2.2.0

type IDToken struct {
	RawToken string
	Claims   Claims
}

type User

type User struct {
	OAuth2Token *oauth2.Token
	IDToken     *IDToken
}

func ExchangeCode

func ExchangeCode(ctx context.Context, r *http.Request, config *oauth2.Config, provider *oidc.Provider) (*User, error)

Jump to

Keyboard shortcuts

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