Documentation ¶
Index ¶
- func Auth(provider string, request *http.Request, response http.ResponseWriter) error
- func ClearProviders()
- func GetDefaultAuthURL(provider string) string
- func GetDefaultEmailURL(provider string) string
- func GetDefaultProfileURL(provider string) string
- func GetDefaultTokenURL(provider string) string
- func Init(x *xorm.Engine) error
- func InitSigningKey() error
- func ProviderCallback(provider string, request *http.Request, response http.ResponseWriter) (goth.User, error)
- func RegisterProvider(providerName, providerType, clientID, clientSecret, ... string, ...) error
- func RemoveProvider(providerName string)
- type CustomURLMapping
- type ErrInvalidAlgorithmType
- type JWTSigningKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearProviders ¶ added in v1.13.1
func ClearProviders()
ClearProviders clears all OAuth2 providers from the goth lib
func GetDefaultAuthURL ¶ added in v1.2.0
GetDefaultAuthURL return the default authorize url for the given provider
func GetDefaultEmailURL ¶ added in v1.2.0
GetDefaultEmailURL return the default email url for the given provider
func GetDefaultProfileURL ¶ added in v1.2.0
GetDefaultProfileURL return the default profile url for the given provider
func GetDefaultTokenURL ¶ added in v1.2.0
GetDefaultTokenURL return the default token url for the given provider
func InitSigningKey ¶ added in v1.15.0
func InitSigningKey() error
InitSigningKey creates the default signing key from settings or creates a random key.
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
CustomURLMapping describes the urls values to use when customizing OAuth2 provider URLs
type ErrInvalidAlgorithmType ¶ added in v1.15.0
type ErrInvalidAlgorithmType struct {
Algorightm string
}
ErrInvalidAlgorithmType represents an invalid algorithm error.
func (ErrInvalidAlgorithmType) Error ¶ added in v1.15.0
func (err ErrInvalidAlgorithmType) Error() string
type JWTSigningKey ¶ added in v1.15.0
type JWTSigningKey interface { IsSymmetric() bool SigningMethod() jwt.SigningMethod SignKey() interface{} VerifyKey() interface{} ToJWK() (map[string]string, error) PreProcessToken(*jwt.Token) }
JWTSigningKey represents a algorithm/key pair to sign JWTs
var DefaultSigningKey JWTSigningKey
DefaultSigningKey is the default signing key for JWTs.
func CreateJWTSingingKey ¶ added in v1.15.0
func CreateJWTSingingKey(algorithm string, key interface{}) (JWTSigningKey, error)
CreateJWTSingingKey creates a signing key from an algorithm / key pair.