gologin: github.com/dghubble/gologin Index | Files | Directories

package gologin

import "github.com/dghubble/gologin"


Package Files

config.go context.go errors.go


var DebugOnlyCookieConfig = CookieConfig{
    Name:     "gologin-temporary-cookie",
    Path:     "/",
    MaxAge:   60,
    HTTPOnly: true,
    Secure:   false,

DebugOnlyCookieConfig configures creation of short-lived temporary http.Cookie's which do NOT require cookies be sent over HTTPS! Use this config for development only.

var DefaultCookieConfig = CookieConfig{
    Name:     "gologin-temporary-cookie",
    Path:     "/",
    MaxAge:   60,
    HTTPOnly: true,
    Secure:   true,

DefaultCookieConfig configures short-lived temporary http.Cookie creation.

var DefaultFailureHandler = http.HandlerFunc(failureHandler)

DefaultFailureHandler responds with a 400 status code and message parsed from the ctx.

func ErrorFromContext Uses

func ErrorFromContext(ctx context.Context) error

ErrorFromContext returns the error value from the ctx or an error that the context was missing an error value.

func WithError Uses

func WithError(ctx context.Context, err error) context.Context

WithError returns a copy of ctx that stores the given error value.

type CookieConfig Uses

type CookieConfig struct {
    // Name is the desired cookie name.
    Name string
    // Domain sets the cookie domain. Defaults to the host name of the responding
    // server when left zero valued.
    Domain string
    // Path sets the cookie path. Defaults to the path of the URL responding to
    // the request when left zero valued.
    Path string
    // MaxAge=0 means no 'Max-Age' attribute should be set.
    // MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'.
    // MaxAge>0 means Max-Age attribute present and given in seconds.
    // Cookie 'Expires' will be set (or left unset) according to MaxAge
    MaxAge int
    // HTTPOnly indicates whether the browser should prohibit a cookie from
    // being accessible via Javascript. Recommended true.
    HTTPOnly bool
    // Secure flag indicating to the browser that the cookie should only be
    // transmitted over a TLS HTTPS connection. Recommended true in production.
    Secure bool

CookieConfig configures http.Cookie creation.


bitbucketPackage bitbucket provides Bitbucket OAuth2 login and callback handlers.
facebookPackage facebook provides Facebook OAuth2 login and callback handlers.
githubPackage github provides Github OAuth2 login and callback handlers.
googlePackage google provides Google OAuth2 login and callback handlers.
oauth1Package oauth1 provides handles for OAuth1 login and callback requests.
oauth2Package oauth2 provides handlers for OAuth2 login and callback requests.
testutilsPackage testutils provides utilities for writing gologin tests.
tumblrPackage tumblr provides Tumblr OAuth1 login and callback handlers.
twitterPackage twitter provides Twitter OAuth1 login, callback, and token handlers.

Package gologin imports 3 packages (graph) and is imported by 64 packages. Updated 2019-08-09. Refresh now. Tools for package owners.