Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GithubAuthenticatedHandler ¶
type GithubAuthenticatedHandler func(w http.ResponseWriter, r *http.Request, user *GithubUser)
type GithubSSO ¶
type GithubSSO interface {
// Initiate the login process by redirecting the user to the github sign-in and approve page.
RedirectToLogin(w http.ResponseWriter, r *http.Request)
// This should be linked to the callback url github has associated with your application.
// This handler takes care of exchanging the code for an access token, and will drop a cookie before redirecting back to "/".
ExchangeCodeForToken(w http.ResponseWriter, r *http.Request)
// Lookup a user from an http request. Will return nil if no valid cookie found.
LookupUser(r *http.Request) *GithubUser
// Make a choice based on the incoming request. If user is already authenticated, the loggedin handler will execute.
// Otherwise, the loggedOut handler will execute.
Route(loggedOut http.HandlerFunc, loggedIn GithubAuthenticatedHandler) http.HandlerFunc
}
GithubSSO manages all sign ins to github, as well as tracking cookies issued to users and the associated github access tokens.
func NewGithubSSO ¶
type GithubUser ¶
type GithubUser struct {
Login, AccessToken, AvatarUrl string
}
Basic information about a user.
func (*GithubUser) GithubApiClient ¶
func (u *GithubUser) GithubApiClient() *http.Client
Creates an http.Client that can be used to make authenticated requests to the github api