Documentation ¶
Index ¶
Constants ¶
const AccountKey = "account"
AccountKey is the key of the current account in the context and session
const ApplicationKey = "application"
ApplicationKey is the key of the current application in the context
Variables ¶
This section is empty.
Functions ¶
func GetApplication ¶
GetApplication returns the application for a web app from the context previouly set by the ApplicationMiddleware
func GetCurrentAccount ¶
GetCurrentAccount retrives the current account if any from the request context
Types ¶
type AccountMiddleware ¶
AccountMiddleware is an http.Handler that unmarshals the current account store in the session and stores it in the request context to be use by any other handler in the chain
func (AccountMiddleware) ServeHTTP ¶
func (accm AccountMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ApplicationMiddleware ¶
type ApplicationMiddleware struct {
ApplicationHref string
}
ApplicationMiddleware is an http.Handler that stores a given account in the request context to be use by any other handler in the chain
func (ApplicationMiddleware) ServeHTTP ¶
func (am ApplicationMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
type AuthCallbackHandler ¶
type AuthCallbackHandler struct { SessionStore sessions.Store SessionName string RedirectURI string }
AuthCallbackHandler is an http.Handler for the ID Site callback
func (AuthCallbackHandler) ServeHTTP ¶
func (cbh AuthCallbackHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP AuthCallbackHandler http.Handler implementation
type AuthenticationMiddleware ¶
type AuthenticationMiddleware struct { Next http.Handler SessionStore sessions.Store SessionName string }
AuthenticationMiddleware handles authentication for a web application, it should only be apply to http.Handlers that require authentication it checks the session for current account if exists it calls handler else redirects with 401 to the given UnauthorizedRedirectURL
func (AuthenticationMiddleware) Authenticate ¶
func (am AuthenticationMiddleware) Authenticate(next http.Handler) http.Handler
Authenticate is a convinices method to authenticate a single http.Handler
func (AuthenticationMiddleware) ServeHTTP ¶
func (am AuthenticationMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
type LoginLogoutHandler ¶
LoginLogoutHandler is an http.Handler use Stormpath ID Site login and logout
func LoginHandler ¶
func LoginHandler(options map[string]string) LoginLogoutHandler
LoginHandler returns a http.Handler for ID Site login
func LogoutHandler ¶
func LogoutHandler(options map[string]string) LoginLogoutHandler
LogoutHandler returns a http.Handler for ID Site logout
func (LoginLogoutHandler) ServeHTTP ¶
func (h LoginLogoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)