Documentation ¶
Index ¶
- type Context
- func (apiContext Context) Authenticate(next http.Handler) http.Handler
- func (apiContext Context) DisallowAnon(h http.Handler) http.Handler
- func (apiContext Context) DisallowAuth(h http.Handler) http.Handler
- func (apiContext Context) HideFromAnon(h http.Handler) http.Handler
- func (apiContext Context) Inject(h http.Handler) http.Handler
- func (apiContext Context) Logging(h http.Handler) http.Handler
- func (apiContext Context) PanicRecovery(h http.Handler) http.Handler
- func (apiContext Context) RequestID(h http.Handler) http.Handler
- type StorageContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
Context is the placeholder for the common API context struct.
func (Context) Authenticate ¶
Authenticate reads the authentication headers and attempts to authenticate the user. If no credentials are specified, the session is continued assuming an anonimus user. If the credentials are wrong, then a HTTP 401 error response is returned.
func (Context) DisallowAnon ¶
DisallowAnon does not allow anonymous users to access the page
func (Context) DisallowAuth ¶
DisallowAuth does not allow authenticated users to access the page
func (Context) HideFromAnon ¶
HideFromAnon returns a HTTP 404 Not Found response for anonymous users.
func (Context) Inject ¶
Inject takes a database connection from the connection pool (performed by Copy) and injects it into the request context.
func (Context) Logging ¶
Logging records all incoming requests to the log. Only in debug trace mode.
func (Context) PanicRecovery ¶
PanicRecovery catches all panics that happen downstream, returns an HTTP 500 Internal Server Error and log the state without crashing the server.
type StorageContext ¶
StorageContext is the alias for the storage context struct.