google

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserInfoURL = "https://www.googleapis.com/oauth2/v3/userinfo"

Functions

This section is empty.

Types

type Config

type Config struct {
	ClientID         string
	ClientSecret     string
	AuthorizeURL     string
	TokenURL         string
	RedirectURL      string
	Scopes           []string
	AllowedDomains   []string
	AuthorizeHandler func(context *auth.Context) (*claims.Claims, error)
}

Config google Config

type GoogleProvider

type GoogleProvider struct {
	*Config
}

GoogleProvider provide login with google method

func New

func New(config *Config) *GoogleProvider

func (GoogleProvider) Callback

func (provider GoogleProvider) Callback(context *auth.Context)

Callback implement Callback with google provider

func (GoogleProvider) ConfigAuth

func (provider GoogleProvider) ConfigAuth(*auth.Auth)

ConfigAuth config auth

func (GoogleProvider) GetName

func (GoogleProvider) GetName() string

GetName return provider name

func (GoogleProvider) Login

func (provider GoogleProvider) Login(context *auth.Context)

Login implemented login with google provider

func (GoogleProvider) Logout

func (GoogleProvider) Logout(context *auth.Context)

Logout implemented logout with google provider

func (GoogleProvider) OAuthConfig

func (provider GoogleProvider) OAuthConfig(context *auth.Context) *oauth2.Config

OAuthConfig return oauth config based on configuration

func (GoogleProvider) Register

func (provider GoogleProvider) Register(context *auth.Context)

Register implemented register with google provider

func (GoogleProvider) ServeHTTP

func (GoogleProvider) ServeHTTP(*auth.Context)

ServeHTTP implement ServeHTTP with google provider

type UserInfo

type UserInfo struct {
	Sub           string `json:"sub"`
	Name          string `json:"name"`
	GivenName     string `json:"given_name"`
	FamilyName    string `json:"family_name"`
	Picture       string `json:"picture"`
	Profile       string `json:"profile"`
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
	Gender        string `json:"gender"`
}

UserInfo google user info structure

Jump to

Keyboard shortcuts

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