negroni-oauth2: Index | Files | Directories

package oauth2

import ""


Package Files



var (
    // PathLogin sets the path to handle OAuth 2.0 logins.
    PathLogin = "/login"
    // PathLogout sets to handle OAuth 2.0 logouts.
    PathLogout = "/logout"
    // PathCallback sets the path to handle callback from OAuth 2.0 backend
    // to exchange credentials.
    PathCallback = "/oauth2callback"
    // PathError sets the path to handle error cases.
    PathError = "/oauth2error"

func Facebook Uses

func Facebook(config *Config) negroni.Handler

func Github Uses

func Github(config *Config) negroni.Handler

Returns a new Github OAuth 2.0 backend endpoint.

func Google Uses

func Google(config *Config) negroni.Handler

Returns a new Google OAuth 2.0 backend endpoint.

func LinkedIn Uses

func LinkedIn(config *Config) negroni.Handler

func LoginRequired Uses

func LoginRequired() negroni.HandlerFunc

Handler that redirects user to the login page if user is not logged in.

func NewOAuth2Provider Uses

func NewOAuth2Provider(config *Config, authUrl, tokenUrl string) negroni.HandlerFunc

Returns a generic OAuth 2.0 backend endpoint.

func SetToken Uses

func SetToken(r *http.Request, t interface{})

type Config Uses

type Config oauth2.Config

type Token Uses

type Token oauth2.Token

type Tokens Uses

type Tokens interface {
    Access() string
    Refresh() string
    Valid() bool
    ExpiryTime() time.Time
    ExtraData(string) interface{}
    Get() Token

Tokens Represents a container that contains user's OAuth 2.0 access and refresh tokens.

func GetToken Uses

func GetToken(r *http.Request) Tokens



Package oauth2 imports 10 packages (graph). Updated 2016-08-18. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).