stormpathweb

package
v0.0.0-...-1fc9397 Latest Latest
Warning

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

Go to latest
Published: May 2, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const AccountKey = "account"

AccountKey is the key of the current account in the context and session

View Source
const ApplicationKey = "application"

ApplicationKey is the key of the current application in the context

Variables

This section is empty.

Functions

func GetApplication

func GetApplication(r *http.Request) *stormpath.Application

GetApplication returns the application for a web app from the context previouly set by the ApplicationMiddleware

func GetCurrentAccount

func GetCurrentAccount(r *http.Request) *stormpath.Account

GetCurrentAccount retrives the current account if any from the request context

Types

type AccountMiddleware

type AccountMiddleware struct {
	SessionStore sessions.Store
	SessionName  string
}

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

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
	UnauthorizedRedirectURL 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

type LoginLogoutHandler

type LoginLogoutHandler struct {
	Options map[string]string
}

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)

Jump to

Keyboard shortcuts

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