oauth2

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(provider string, request *http.Request, response http.ResponseWriter) error

Auth OAuth2 auth service

func GetDefaultAuthURL added in v1.2.0

func GetDefaultAuthURL(provider string) string

GetDefaultAuthURL return the default authorize url for the given provider

func GetDefaultEmailURL added in v1.2.0

func GetDefaultEmailURL(provider string) string

GetDefaultEmailURL return the default email url for the given provider

func GetDefaultProfileURL added in v1.2.0

func GetDefaultProfileURL(provider string) string

GetDefaultProfileURL return the default profile url for the given provider

func GetDefaultTokenURL added in v1.2.0

func GetDefaultTokenURL(provider string) string

GetDefaultTokenURL return the default token url for the given provider

func Init

func Init(x *xorm.Engine) error

Init initialize the setup of the OAuth2 library

func ProviderCallback

func ProviderCallback(provider string, request *http.Request, response http.ResponseWriter) (goth.User, error)

ProviderCallback handles OAuth callback, resolve to a goth user and send back to original url this will trigger a new authentication request, but because we save it in the session we can use that

func RegisterProvider

func RegisterProvider(providerName, providerType, clientID, clientSecret, openIDConnectAutoDiscoveryURL string, customURLMapping *CustomURLMapping) error

RegisterProvider register a OAuth2 provider in goth lib

func RemoveProvider

func RemoveProvider(providerName string)

RemoveProvider removes the given OAuth2 provider from the goth lib

Types

type CustomURLMapping added in v1.2.0

type CustomURLMapping struct {
	AuthURL    string
	TokenURL   string
	ProfileURL string
	EmailURL   string
}

CustomURLMapping describes the urls values to use when customizing OAuth2 provider URLs

Jump to

Keyboard shortcuts

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