ssgo: Index | Files | Directories

package ssgo

import ""


Package Files

boltUtil.go ssgo.go

func EnsureBoltBucketExists Uses

func EnsureBoltBucketExists(bucket string) error

func GetDb Uses

func GetDb() *bolt.DB

func LookupBoltJson Uses

func LookupBoltJson(bucket string, key string, v interface{}) error

func StoreBoltJson Uses

func StoreBoltJson(bucket string, key string, data interface{}) error

type AuthenticatedHandler Uses

type AuthenticatedHandler func(w http.ResponseWriter, r *http.Request, credentials *Credentials)

Like an http.HandleFunc, but accepts a credentials object as a third argument.

type Credentials Uses

type Credentials struct {
    // Shortname of site they are authenticated with
    Site string
    // Oauth token for user.
    Token *oauth2.Token
    // Http client with oauth credentials ready to go.
    Client *http.Client

Container for a user's oauth credentials

type SSO Uses

type SSO interface {
    //Redirect the request to the provider's authorization page
    RedirectToLogin(w http.ResponseWriter, r *http.Request)
    //Handle callback from authorization page. This needs to be hosted at the url that is registered with the provider.
    ExchangeCodeForToken(w http.ResponseWriter, r *http.Request)
    //Lookup the credentials for a given request from the cookie. Will return nil if no valid cookie is found.
    LookupToken(r *http.Request) *Credentials
    //Basic http handler that looks up the token for you and provides credentials to your handler. Credentials may be nil.
    Handle(handler AuthenticatedHandler) http.HandlerFunc
    //Select a handler based on whether the user has a valid cookie or not.
    Route(loggedOut http.HandlerFunc, loggedIn AuthenticatedHandler) http.HandlerFunc

    ClearCookie(w http.ResponseWriter)

Core interface for working with a third-party website

func NewGithub Uses

func NewGithub(clientId, clientSecret string, scopes ...string) SSO

func NewReddit Uses

func NewReddit(clientId, clientSecret, redirectUri string, scopes ...string) SSO



Package ssgo imports 9 packages (graph) and is imported by 3 packages. Updated 2016-07-16. Refresh now. Tools for package owners.