Documentation ¶
Index ¶
- Variables
- func Facebook(opt ...oauth2.Option) negroni.Handler
- func Github(opt ...oauth2.Option) negroni.Handler
- func Google(opt ...oauth2.Option) negroni.Handler
- func LinkedIn(opt ...oauth2.Option) negroni.Handler
- func LoginRequired() negroni.HandlerFunc
- func NewOAuth2Provider(opts []oauth2.Option) negroni.HandlerFunc
- func SetToken(r *http.Request, t interface{})
- type Options
- type Tokens
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Path to handle OAuth 2.0 logins. PathLogin = "/login" // Path to handle OAuth 2.0 logouts. PathLogout = "/logout" // Path to handle callback from OAuth 2.0 backend // to exchange credentials. PathCallback = "/oauth2callback" // Path to handle error cases. PathError = "/oauth2error" )
Functions ¶
func LoginRequired ¶
func LoginRequired() negroni.HandlerFunc
Handler that redirects user to the login page if user is not logged in.
func NewOAuth2Provider ¶
func NewOAuth2Provider(opts []oauth2.Option) negroni.HandlerFunc
Returns a generic OAuth 2.0 backend endpoint.
Types ¶
type Options ¶
type Options struct { // ClientID is the OAuth client identifier used when communicating with // the configured OAuth provider. ClientID string `json:"client_id"` // ClientSecret is the OAuth client secret used when communicating with // the configured OAuth provider. ClientSecret string `json:"client_secret"` // RedirectURL is the URL to which the user will be returned after // granting (or denying) access. RedirectURL string `json:"redirect_url"` // Optional, identifies the level of access being requested. Scopes []string `json:"scopes"` // Optional, "online" (default) or "offline", no refresh token if "online" AccessType string `json:"omit"` // ApprovalPrompt indicates whether the user should be // re-prompted for consent. If set to "auto" (default) the // user will be prompted only if they haven't previously // granted consent and the code can only be exchanged for an // access token. // If set to "force" the user will always be prompted, and the // code can be exchanged for a refresh token. ApprovalPrompt string `json:"omit"` }
Click to show internal directories.
Click to hide internal directories.