oauth2

package
v0.0.0-...-ef18f62 Latest Latest
Warning

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

Go to latest
Published: May 8, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Strategy oauth2.Config
	State    string
}

Config type.

type Manager

type Manager struct {
	Config         *Config
	SessionManager *session.Manager
}

Manager type. Manager to handle an OAuth2 session. OAuth2 is required to invoke the GitHub APIs on behalf the user.

func NewManager

func NewManager(config *Config, sessionManager *session.Manager) *Manager

NewManager is the constructor for OAuth2 Manager.

func (Manager) Authorize

func (oauth2Manager Manager) Authorize(w http.ResponseWriter, r *http.Request)

Authorize to request for OAuth2 authorization against GitHub.

func (Manager) AuthorizeCallback

func (oauth2Manager Manager) AuthorizeCallback(w http.ResponseWriter, r *http.Request)

AuthorizeCallback to handle the authorize callback from GitHub.

func (Manager) GetClient

func (oauth2Manager Manager) GetClient(r *http.Request) *http.Client

GetClient to set up an OAuth2 HTTP client able to access GitHub APIs. The access token is obtained from the session.

func (Manager) GetClientFromAccessToken

func (oauth2Manager Manager) GetClientFromAccessToken(accessToken string) *http.Client

GetClientFromAccessToken to set up an OAuth2 HTTP client able to access GitHub APIs. The access token is passed as a parameter.

func (Manager) GetSessionAccessToken

func (oauth2Manager Manager) GetSessionAccessToken(r *http.Request) string

GetSessionAccessToken to get the OAuth2 access token from the session.

func (Manager) Logout

func (oauth2Manager Manager) Logout(w http.ResponseWriter, r *http.Request)

Logout to destroy the session.

func (Manager) SetSessionAccessToken

func (oauth2Manager Manager) SetSessionAccessToken(accessToken string, w http.ResponseWriter, r *http.Request)

SetSessionAccessToken to store the OAuth2 access token in the session

Jump to

Keyboard shortcuts

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