auth

package
v0.0.0-...-6d03e5b Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	SessionSecret string
	GithubID      string
	GithubSecret  string
	Domain        string
	RedirectPath  string
	LoginPath     string
	HomePath      string
	Scopes        []string
	// contains filtered or unexported fields
}

func (*Auth) CallbackHandler

func (a *Auth) CallbackHandler() http.Handler

func (*Auth) Init

func (a *Auth) Init()

func (*Auth) IsAuthenticated

func (a *Auth) IsAuthenticated(r *http.Request) bool

IsAuthenticated returns true if the user has a signed session cookie.

func (*Auth) LoginHandler

func (a *Auth) LoginHandler() http.Handler

func (*Auth) LogoutHandler

func (a *Auth) LogoutHandler() http.Handler

func (*Auth) MayLogin

func (a *Auth) MayLogin(next http.Handler) http.Handler

MayLogin sets the user to the context if it is available.

func (*Auth) RequireLogin

func (a *Auth) RequireLogin(next http.Handler) http.Handler

RequireLogin redirects unauthenticated users to the login route. It stores the user in the request context in case that the request is authenticated.

func (*Auth) User

func (a *Auth) User(r *http.Request) *gogithub.User

User returns the user from the request context.

Jump to

Keyboard shortcuts

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