Documentation
¶
Index ¶
- func Auth(store AuthDB, strategies strategy.Strategies, httpClient *http.Client) http.Handler
- func Callback(store CallbackDB, strat strategy.Strategy, generator func() (string, error)) http.Handler
- func Choose(baseURL string, store ChooseDB, strategies strategy.Strategies, ...) http.Handler
- func Continue(store ContinueDB, generator func() (string, error)) http.Handler
- func Example(baseURL string, conf config.Config, store sessions.Store, tokenStore ExampleDB, ...) http.HandlerFunc
- func ExampleCallback(baseURL string, store sessions.Store) http.HandlerFunc
- func ExampleForget(baseURL string, store sessions.Store, tokenStore ExampleDB) http.HandlerFunc
- func ExampleGenerate(baseURL string, store sessions.Store, generator func(int) (string, error), ...) http.HandlerFunc
- func ExamplePrivacy(templates tmpl) http.HandlerFunc
- func ExampleRevoke(baseURL string, store sessions.Store, tokenStore ExampleDB) http.HandlerFunc
- func ExampleSignIn(baseURL string, store sessions.Store) http.HandlerFunc
- func ExampleSignOut(baseURL string, store sessions.Store) http.HandlerFunc
- func PGP(templates tmpl) http.HandlerFunc
- func Token(store TokenDB, generator func(int) (string, error)) http.Handler
- func Verify(store VerifyDB) http.Handler
- func WebSocket(strategies strategy.Strategies, store WebSocketDB, relMe *microformats.RelMe) http.Handler
- type AuthDB
- type CallbackDB
- type ChooseDB
- type ContinueDB
- type ExampleDB
- type TokenDB
- type VerifyDB
- type WebSocketDB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Auth ¶
Auth takes the chosen provider and initiates authentication by redirecting the user to the 3rd party. It takes a number of parameters:
- me: URL originally entered of who we are trying to authenticate
- provider: 3rd party authentication provider that was chosen
- profile: URL expected to be matched by the provider
- redirect_uri: final URI to redirect to when auth is finished
func Callback ¶
func Callback(store CallbackDB, strat strategy.Strategy, generator func() (string, error)) http.Handler
Callback handles the return from the authentication provider by delegating to the relevant strategy. If authentication was successful, and for the correct user, then it will redirect to the "redirect_uri" that the authentication flow was originally started with. A "code" parameter is returned which can be verified as belonging to the authenticated user for a short period of time.
func Choose ¶
func Choose(baseURL string, store ChooseDB, strategies strategy.Strategies, chooseTemplate, meTemplate tmpl) http.Handler
Choose finds, for the "me" parameter, all authentication providers that can be used for authentication.
func Continue ¶
func Continue(store ContinueDB, generator func() (string, error)) http.Handler
Continue handles a user choosing to authenticate using a previous session.
func Example ¶
func Example(baseURL string, conf config.Config, store sessions.Store, tokenStore ExampleDB, welcomeTemplate, accountTemplate tmpl) http.HandlerFunc
Example implements a basic site using the authentication flow provided by this package.
func ExampleCallback ¶
func ExampleCallback(baseURL string, store sessions.Store) http.HandlerFunc
ExampleCallback implements the authentication callback for Example. It verifies the code, then sets the value of "me" in a session cookie.
func ExampleForget ¶
func ExampleGenerate ¶
func ExamplePrivacy ¶
func ExamplePrivacy(templates tmpl) http.HandlerFunc
func ExampleRevoke ¶
ExampleRevoke removes the token for the client_id.
func ExampleSignIn ¶
func ExampleSignIn(baseURL string, store sessions.Store) http.HandlerFunc
func ExampleSignOut ¶
func ExampleSignOut(baseURL string, store sessions.Store) http.HandlerFunc
ExampleSignOut removes the value of "me" from the session cookie.
func PGP ¶
func PGP(templates tmpl) http.HandlerFunc
PGP creates a http.Handler that serves a random challenge for the user to clearsign.
func Verify ¶
Verify allows clients to check who a particular "code" belongs to, or whether it is invalid.
func WebSocket ¶
func WebSocket(strategies strategy.Strategies, store WebSocketDB, relMe *microformats.RelMe) http.Handler
WebSocket returns a http.Handler that handles websocket connections. The client can request a set of authentication methods for a user.