Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
// TokenKey is the key under which an oAuth Token is stored in a context
TokenKey tokenkey
)
Functions ¶
func NewRequest ¶
func NewRequest(s session.Handler, c *oauth2.Config) (Authentifier, CallbackHandler)
NewRequest returns a new user Authentifier object that handles a http request for user authentication.
Types ¶
type Authentifier ¶
type Authentifier struct { Session session.Handler *oauth2.Config Options []oauth2.AuthCodeOption Log *log.Logger }
Authentifier defines a http request handler that will initiate the oAuth request.
func (Authentifier) AuthCodeOptions ¶
func (l Authentifier) AuthCodeOptions(opt ...oauth2.AuthCodeOption) Authentifier
AuthCodeOptions allows to add some options that will parameterize the login request. By default, nothing is passed which means that no refresh token is requested.
func (Authentifier) ServeHTTP ¶
func (l Authentifier) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles the request.
type CallbackHandler ¶
type CallbackHandler struct {
// contains filtered or unexported fields
}
CallbackHandler defines a http request handler that will deal with the finalization of the oAuth request by saving the authorization token in the session store and the context object and executing either user Authentication (aka user signin) or user Registration (aka user signup).
func (CallbackHandler) Link ¶
func (c CallbackHandler) Link(hn xhttp.Handler) xhttp.HandlerLinker
Link enables the linking of a xhttp.Handler to the CallbackHandler.
func (CallbackHandler) ServeHTTP ¶
func (c CallbackHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles the request.