Documentation ¶
Index ¶
- func InitApp(envVars helpers.EnvVars, env *cfenv.App) (*web.Router, *helpers.Settings, error)
- func InitRouter(settings *helpers.Settings, templates *template.Template) *web.Router
- type APIContext
- type Context
- func (c *Context) Index(w web.ResponseWriter, r *web.Request)
- func (c *Context) LoginHandshake(rw web.ResponseWriter, req *web.Request)
- func (c *Context) LoginRequired(rw web.ResponseWriter, r *web.Request, next web.NextMiddlewareFunc)
- func (c *Context) OAuthCallback(rw web.ResponseWriter, req *web.Request)
- func (c *Context) Ping(rw web.ResponseWriter, req *web.Request)
- type LogContext
- type ResponseHandler
- type SecureContext
- type UAAContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIContext ¶
type APIContext struct {
*SecureContext // Required.
}
APIContext stores the session info and access token per user. All routes within APIContext represent the API routes
func (*APIContext) APIProxy ¶
func (c *APIContext) APIProxy(rw web.ResponseWriter, req *web.Request)
APIProxy is a handler that serves as a proxy for all the CF API. Any route that comes in the /v2/* route that has not been specified, will just come here.
func (*APIContext) AuthStatus ¶
func (c *APIContext) AuthStatus(rw web.ResponseWriter, req *web.Request)
AuthStatus simply returns authorized. This endpoint is just a quick endpoint to indicate that if a user can reach here after passing through the OAuth Middleware, they are authorized.
func (*APIContext) Logout ¶
func (c *APIContext) Logout(rw web.ResponseWriter, req *web.Request)
Logout is a handler that will attempt to clear the session information for the current user.
func (*APIContext) UserProfile ¶
func (c *APIContext) UserProfile(rw web.ResponseWriter, req *web.Request)
UserProfile redirects users to the `/profile` page
type Context ¶
Context represents the context for all requests that do not need authentication.
func (*Context) Index ¶
func (c *Context) Index(w web.ResponseWriter, r *web.Request)
Index serves index.html
func (*Context) LoginHandshake ¶
func (c *Context) LoginHandshake(rw web.ResponseWriter, req *web.Request)
LoginHandshake is the handler where we authenticate the user and the user authorizes this application access to information.
func (*Context) LoginRequired ¶
func (c *Context) LoginRequired(rw web.ResponseWriter, r *web.Request, next web.NextMiddlewareFunc)
LoginRequired is a middleware that requires a valid toker or redirects to the handshake page.
func (*Context) OAuthCallback ¶
func (c *Context) OAuthCallback(rw web.ResponseWriter, req *web.Request)
OAuthCallback is the function that is called when the UAA provider uses the "redirect_uri" field to call back to this backend. This function will extract the code, get the access token and refresh token and save it into 1) the session and redirect to the frontend dashboard.
type LogContext ¶
type LogContext struct {
*SecureContext // Required.
}
LogContext stores the session info and access token per user. All routes within LogContext represent the Loggregator routes
func (*LogContext) ParseLogMessages ¶
func (c *LogContext) ParseLogMessages(body *io.ReadCloser, contentType string) (*bytes.Buffer, error)
ParseLogMessages is a modified version of httpRecent. https://github.com/cloudfoundry/loggregator_consumer/blob/89d7fe237afae1e8222554359ec03b72c8466d10/consumer.go#L145 Also, when using their Recent function, we would get unauthorized errors. If we make the request ourselves, it works. TODO eventually figure out the cause of the unauthorized errors
func (*LogContext) RecentLogs ¶
func (c *LogContext) RecentLogs(rw web.ResponseWriter, req *web.Request)
RecentLogs returns a log dump of the given app.
type ResponseHandler ¶
type ResponseHandler func(*http.ResponseWriter, *http.Response)
ResponseHandler is a type declaration for the function that will handle the response for the given request.
type SecureContext ¶
SecureContext stores the session info and access token per user.
func (*SecureContext) GenericResponseHandler ¶
func (c *SecureContext) GenericResponseHandler(rw *http.ResponseWriter, response *http.Response)
GenericResponseHandler is a normal handler for responses received from the proxy requests.
func (*SecureContext) OAuth ¶
func (c *SecureContext) OAuth(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)
OAuth is a middle ware that checks whether or not the user has a valid token. If the token is present and still valid, it just passes it on. If the token is 1) present and expired or 2) not present, it will return unauthorized.
func (*SecureContext) Proxy ¶
func (c *SecureContext) Proxy(rw http.ResponseWriter, req *http.Request, url string, responseHandler ResponseHandler)
Proxy is an internal function that will construct the client with the token in the headers and then send a request.
type UAAContext ¶
type UAAContext struct {
*SecureContext // Required.
}
UAAContext stores the session info and access token per user. All routes within UAAContext represent the routes to the UAA service.
func (*UAAContext) UserInfo ¶
func (c *UAAContext) UserInfo(rw web.ResponseWriter, req *web.Request)
UserInfo returns the UAA_API/userinfo information for the logged in user.