Documentation ¶
Index ¶
- Constants
- func GetApplication(r *http.Request) *stormpath.Application
- func GetCurrentAccount(r *http.Request) *stormpath.Account
- func IsAuthenticated(r *http.Request) bool
- type AccountMiddleware
- type ApplicationMiddleware
- type AuthenticationMiddleware
- type IDSiteAuthCallbackHandler
- type IDSiteLoginHandler
- type IDSiteLogoutHandler
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 from the context previouly set by the ApplicationMiddleware
func GetCurrentAccount ¶
GetCurrentAccount retrives the current account if any from the request context
func IsAuthenticated ¶
IsAuthenticated checks if there is an authenticated user
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 (m AccountMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface for the AccountMiddleware type
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 handlers in the chain.
func (ApplicationMiddleware) ServeHTTP ¶
func (m ApplicationMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface for the ApplicationMiddleware type
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 it applies the UnauthorizedHandler
func (AuthenticationMiddleware) ServeHTTP ¶
func (m AuthenticationMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface for the AuthenticationMiddleware type
type IDSiteAuthCallbackHandler ¶
type IDSiteAuthCallbackHandler struct { SessionStore sessions.Store SessionName string LoginRedirectURI string LogoutRedirectURI string ErrorHandler http.Handler }
IDSiteAuthCallbackHandler is an http.Handler for the ID Site callback
func (IDSiteAuthCallbackHandler) ServeHTTP ¶
func (h IDSiteAuthCallbackHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface for the IDSiteAuthCallbackHandler type
type IDSiteLoginHandler ¶
IDSiteLoginHandler is an http.Handler for Strompath's IDSite login
func (IDSiteLoginHandler) ServeHTTP ¶
func (h IDSiteLoginHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface for IDSiteLoginHandler type
type IDSiteLogoutHandler ¶
IDSiteLogoutHandler is an http.Handler for Strompath's IDSite logout
func (IDSiteLogoutHandler) ServeHTTP ¶
func (h IDSiteLogoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface for IDSiteLogoutHandler type