Documentation ¶
Overview ¶
Package middleware offers pluggable capabilities of varying purpose such as session authentication checks. They can be placed in the call stack of any HTTP handler routine so that they are called prior to advancing to the main work of each handler function, keeping them small.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authorized ¶
func Authorized(jwtGetter JWTSigningSecretGetter) gin.HandlerFunc
Authorized is run as a middleware in every callstack of an HTTP service endpoint that requires authentication. It looks for, parses, and validates the JWT supplied by requesting client.
func CookieRemoveRedirect ¶
CookieRemoveRedirect deletes this application's authentication cookie and redirects to index page.
func NotAuthorized ¶
func NotAuthorized() gin.HandlerFunc
NotAuthorized ensures that only clients with no 'Protokollamt' cookie present continue to the index page again. This allows to directly redirect to restricted pages if a correctly named cookie is found. Its validity is checked on a restricted page.
Types ¶
type JWTSigningSecretGetter ¶
type JWTSigningSecretGetter interface {
GetJWTSigningSecret() string
}
JWTSigningSecretGetter defines the one method needed to obtain initially set JWT signing secret.