facebook

package
v0.0.0-...-1c0eac8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	IdentityURL string
	// contains filtered or unexported fields
}

Provider holds all the info for our Oauth2 provider.

func New

func New() *Provider

New returns a new provider. Some providers have their endpoints as part of the Oauth2 package.

func (*Provider) BuildAuthURL

func (p *Provider) BuildAuthURL(state string) string

BuildAuthURL builds the authenticartion endpoint that we redirect our users to. State needs to be an unguessable string (probability of guessing < 2^128).

It might be possible here to write some helper that generates a cryptographically secure state string, and uses that an a nonce. Since the provider instance is "alive" across our middleware, we could tack the nonce onto the middleware, and verify it once the identity provider returns it?

func (*Provider) GetCodeURL

func (p *Provider) GetCodeURL(r *http.Request) string

GetCodeURL gets the short-lived access code from the callback URL that we can exchange for an access token.

func (*Provider) GetIdentity

func (p *Provider) GetIdentity(tok *oauth2.Token) (*id.User, error)

GetIdentity gets the client's identity from the provider.

func (*Provider) GetToken

func (p *Provider) GetToken(code string) (*oauth2.Token, error)

GetToken gets the access and refresh tokens from the provider. Should probably be called `GetTokens`.

Jump to

Keyboard shortcuts

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