gothic

package
v0.0.0-...-c628598 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package gothic wraps common behaviour when using Goth. This makes it quick, and easy, to get up and running with Goth. Of course, if you want complete control over how things flow, in regards to the authentication process, feel free and use Goth directly.

See https://github.com/markbates/goth/examples/main.go to see this in action.

Index

Constants

View Source
const SessionName = "_gothic_session"

SessionName is the key used to access the session store.

Variables

View Source
var AppKey = "XDZZYmriq8pJ5k8OKqdDuUFym2e7Im5O1MzdyapfotOnrqQ7ZEdTN9AA7K6aPieC"

AppKey should be replaced by applications using gothic.

View Source
var GetProviderName = getProviderName

GetProviderName is a function used to get the name of a provider for a given request. By default, this provider is fetched from the URL query string. If you provide it in a different way, assign your own function to this variable that returns the provider name for your request.

View Source
var GetState = func(req *http.Request) string {
	return "state"
}

GetState gets the state string associated with the given request This state is sent to the provider and can be retrieved during the callback.

Store can/should be set by applications using gothic. The default is a cookie store.

Functions

func BeginAuthHandler

func BeginAuthHandler(res http.ResponseWriter, req *http.Request)

BeginAuthHandler is a convienence handler for starting the authentication process. It expects to be able to get the name of the provider from the query parameters as either "provider" or ":provider".

BeginAuthHandler will redirect the user to the appropriate authentication end-point for the requested provider.

See https://github.com/markbates/goth/examples/main.go to see this in action.

func CompleteUserAuth

func CompleteUserAuth(res http.ResponseWriter, req *http.Request) (goth.User, error)

CompleteUserAuth does what it says on the tin. It completes the authentication process and fetches all of the basic information about the user from the provider.

It expects to be able to get the name of the provider from the query parameters as either "provider" or ":provider".

See https://github.com/markbates/goth/examples/main.go to see this in action.

func GetAuthURL

func GetAuthURL(res http.ResponseWriter, req *http.Request) (string, error)

GetAuthURL starts the authentication process with the requested provided. It will return a URL that should be used to send users to.

It expects to be able to get the name of the provider from the query parameters as either "provider" or ":provider".

I would recommend using the BeginAuthHandler instead of doing all of these steps yourself, but that's entirely up to you.

Types

This section is empty.

Jump to

Keyboard shortcuts

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