Documentation ¶
Overview ¶
Package alogin defines the Login interface for handling login in web applications.
The implementations of Login should be used with the //infra-sk/modules/alogin-sk control.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EMail ¶
type EMail string
Email is an email address.
const NotLoggedIn EMail = ""
NotLoggedIn is the EMail value used to indicate a user is not logged in.
type Login ¶
type Login interface { // LoggedInAs returns the email of the logged in user, or the empty string // of they are not logged in. LoggedInAs(r *http.Request) EMail // NeedsAuthentication will send the right response to the user if they // attempt to use a resource that requires authentication, such as // redirecting them to a login URL or returning an http.StatusForbidden // response code. NeedsAuthentication(w http.ResponseWriter, r *http.Request) // RegisterHandlers registers HTTP handlers for any endpoints that need // handling. RegisterHandlers(router *mux.Router) // Status returns the logged in status and other details about the current // user. Status(r *http.Request) Status }
Login is an abstraction of the functionality we use out of the go/login package.
type Status ¶
type Status struct { // LoginURL is the URL to visit to log in. LoginURL string `json:"login"` // LogoutURL is the URL to visit to log out. LogoutURL string `json:"logout"` // EMail is the email address of the logged in user, or the empty string if // they are not logged in. EMail EMail `json:"email"` }
Status describes the logged in status for a user. Email will be empty if the user is not logged in.
Directories ¶
Path | Synopsis |
---|---|
Package proxylogin implements alogin.Login when letting a reverse proxy handle authentication
|
Package proxylogin implements alogin.Login when letting a reverse proxy handle authentication |
Package sklogin implmements alogin.Login using the //go/login package.
|
Package sklogin implmements alogin.Login using the //go/login package. |
Click to show internal directories.
Click to hide internal directories.