Documentation ¶
Index ¶
- func Admin(s *scs.SessionManager) web.Middleware
- func Authenticate(s *scs.SessionManager) web.Middleware
- func HandleLogin(db *sqlx.DB, session *scs.SessionManager) web.Handler
- func HandleLogout(session *scs.SessionManager) web.Handler
- func HandleOauthCallback(db *sqlx.DB, session *scs.SessionManager, provs map[string]Provider, ...) web.Handler
- func HandleOauthLogin(session *scs.SessionManager, provs map[string]Provider) web.Handler
- func HandleSignup(db *sqlx.DB, session *scs.SessionManager, activationRequired bool) web.Handler
- func LoadAndSave(s *scs.SessionManager) web.Middleware
- func MakeProviders(ctx context.Context, cfg []ProviderConfig) (map[string]Provider, error)
- func SaveUserSession(ctx context.Context, session *scs.SessionManager, userID string, role string) error
- type Provider
- type ProviderConfig
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Admin ¶
func Admin(s *scs.SessionManager) web.Middleware
Authenticate returns a middleware intended to protect routes which require an administrator.
func Authenticate ¶
func Authenticate(s *scs.SessionManager) web.Middleware
Authenticate returns a middleware intended to protect routes which require an authenticated user.
func HandleLogin ¶
HandleLogin makes a session for the user if the passed credentials are correct.
func HandleLogout ¶
HandleLogout cancels the user's session.
func HandleOauthCallback ¶
func HandleOauthCallback(db *sqlx.DB, session *scs.SessionManager, provs map[string]Provider, redirect string) web.Handler
HandleOauthLogin completes the Oauth flow for the user and creates a new authenticated session.
func HandleOauthLogin ¶
HandleOauthLogin starts the Oauth flow to authenticate the user. It returns the URL to complete the authentication on the specified external provider.
func HandleSignup ¶
HandleSignup tries to register the user with the passed information. If activationRequired is true, users need to confirm the registration via email.
func LoadAndSave ¶
func LoadAndSave(s *scs.SessionManager) web.Middleware
LoadAndSave updates the user's session if there was a change.
func MakeProviders ¶
MakeProviders builds supported Oauth providers.