google

package
v0.0.0-...-2535ed7 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PREFIX     = path_helpers.GetCalledDir()
	I18N_GROUP = i18nmod.PkgToGroup(PREFIX)
)
View Source
var UserInfoURL = "https://www.googleapis.com/oauth2/v3/userinfo"

Functions

This section is empty.

Types

type Config

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

Config google Config

func (Config) GetDefaultName

func (Config) GetDefaultName() string

GetDefaultName return provider name

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 (p GoogleProvider) GetName() string

GetName return provider name

func (GoogleProvider) I18n

func (p GoogleProvider) I18n(key ...string) string

I18n returh i18n key prefix

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