Documentation ¶
Index ¶
- Constants
- func AutheliaMiddleware(configuration schema.Configuration, providers Providers) func(next RequestHandler) fasthttp.RequestHandler
- func LogRequestMiddleware(next fasthttp.RequestHandler) fasthttp.RequestHandler
- type AutheliaCtx
- func (c *AutheliaCtx) Error(err error, message string)
- func (c *AutheliaCtx) GetSession() session.UserSession
- func (c *AutheliaCtx) ParseBody(value interface{}) error
- func (c *AutheliaCtx) RemoteIP() net.IP
- func (c *AutheliaCtx) ReplyForbidden()
- func (c *AutheliaCtx) ReplyOK()
- func (c *AutheliaCtx) ReplyUnauthorized()
- func (c *AutheliaCtx) SaveSession(userSession session.UserSession) error
- func (c *AutheliaCtx) SetJSONBody(value interface{}) error
- func (c *AutheliaCtx) XForwardedHost() []byte
- func (c *AutheliaCtx) XForwardedProto() []byte
- func (c *AutheliaCtx) XForwardedURI() []byte
- func (c *AutheliaCtx) XOriginalURL() []byte
- type ErrorResponse
- type IdentityVerificationClaim
- type IdentityVerificationFinishArgs
- type IdentityVerificationFinishBody
- type IdentityVerificationStartArgs
- type Middleware
- type OKResponse
- type Providers
- type RequestHandler
Constants ¶
const InternalError = "Internal error."
InternalError is the error message sent when there was an internal error but it should be hidden to the end user. In that case the error should be in the server logs.
UnauthorizedError is the error message sent when the user is not authorized.
Variables ¶
This section is empty.
Functions ¶
func AutheliaMiddleware ¶
func AutheliaMiddleware(configuration schema.Configuration, providers Providers) func(next RequestHandler) fasthttp.RequestHandler
AutheliaMiddleware is wrapping the RequestCtx into an AutheliaCtx providing Authelia related objects.
func LogRequestMiddleware ¶
func LogRequestMiddleware(next fasthttp.RequestHandler) fasthttp.RequestHandler
LogRequestMiddleware logs the query that is being treated.
Types ¶
type AutheliaCtx ¶
type AutheliaCtx struct { *fasthttp.RequestCtx Logger *logrus.Entry Providers Providers Configuration schema.Configuration // contains filtered or unexported fields }
AutheliaCtx contains all server variables related to Authelia.
func NewAutheliaCtx ¶
func NewAutheliaCtx(ctx *fasthttp.RequestCtx, configuration schema.Configuration, providers Providers) (*AutheliaCtx, error)
NewAutheliaCtx instantiate an AutheliaCtx out of a RequestCtx.
func (*AutheliaCtx) Error ¶
func (c *AutheliaCtx) Error(err error, message string)
func (*AutheliaCtx) GetSession ¶
func (c *AutheliaCtx) GetSession() session.UserSession
GetSession return the user session. Any update will be saved in cache.
func (*AutheliaCtx) ParseBody ¶
func (c *AutheliaCtx) ParseBody(value interface{}) error
ParseBody parse the request body into the type of value
func (*AutheliaCtx) RemoteIP ¶
func (c *AutheliaCtx) RemoteIP() net.IP
RemoteIP return the remote IP taking X-Forwarded-For header into account if provided.
func (*AutheliaCtx) ReplyForbidden ¶
func (c *AutheliaCtx) ReplyForbidden()
ReplyForbidden response sent when access is forbidden to user
func (*AutheliaCtx) ReplyOK ¶
func (c *AutheliaCtx) ReplyOK()
ReplyOK is a helper method to reply ok
func (*AutheliaCtx) ReplyUnauthorized ¶
func (c *AutheliaCtx) ReplyUnauthorized()
ReplyUnauthorized response sent when user is unauthorized
func (*AutheliaCtx) SaveSession ¶
func (c *AutheliaCtx) SaveSession(userSession session.UserSession) error
SaveSession save the content of the session.
func (*AutheliaCtx) SetJSONBody ¶
func (c *AutheliaCtx) SetJSONBody(value interface{}) error
SetJSONBody Set json body
func (*AutheliaCtx) XForwardedHost ¶
func (c *AutheliaCtx) XForwardedHost() []byte
XForwardedHost return the content of the header X-Forwarded-Host
func (*AutheliaCtx) XForwardedProto ¶
func (c *AutheliaCtx) XForwardedProto() []byte
XForwardedProto return the content of the header X-Forwarded-Proto
func (*AutheliaCtx) XForwardedURI ¶
func (c *AutheliaCtx) XForwardedURI() []byte
XForwardedURI return the content of the header X-Forwarded-URI
func (*AutheliaCtx) XOriginalURL ¶
func (c *AutheliaCtx) XOriginalURL() []byte
XOriginalURL return the content of the header X-Original-URL
type ErrorResponse ¶
ErrorResponse model of an error response
type IdentityVerificationClaim ¶
type IdentityVerificationClaim struct { jwt.StandardClaims // The action this token has been crafted for. Action string `json:"action"` // The user this token has been crafted for. Username string `json:"username"` }
IdentityVerificationClaim custom claim for specifying the action claim. The action can be to register a TOTP device, a U2F device or reset one's password.
type IdentityVerificationFinishArgs ¶
type IdentityVerificationFinishArgs struct { // The action claim that should be in the token to consider the action legitimate ActionClaim string // The function for checking the user in the token is valid for the current action IsTokenUserValidFunc func(ctx *AutheliaCtx, username string) bool }
IdentityVerificationFinishArgs represent the arguments used to customize the finishing phase of the identity verification process.
type IdentityVerificationFinishBody ¶
type IdentityVerificationFinishBody struct {
Token string `json:"token"`
}
IdentityVerificationFinishBody type of the body received by the finish endpoint.
type IdentityVerificationStartArgs ¶
type IdentityVerificationStartArgs struct { // Email template needs a subject, a title and the content of the button. MailSubject string MailTitle string MailButtonContent string // The target endpoint where to redirect the user when verification process // is completed successfully. TargetEndpoint string // The action claim that will be stored in the JWT token ActionClaim string // The function retrieving the identity to who the email will be sent. IdentityRetrieverFunc func(ctx *AutheliaCtx) (*session.Identity, error) // The function for checking the user in the token is valid for the current action IsTokenUserValidFunc func(ctx *AutheliaCtx, username string) bool }
IdentityVerificationStartArgs represent the arguments used to customize the starting phase of the identity verification process.
type Middleware ¶
type Middleware = func(RequestHandler) RequestHandler
Middleware represent an Authelia middleware.
type OKResponse ¶
type OKResponse struct { Status string `json:"status"` Data interface{} `json:"data"` }
OKResponse model of a status OK response
type Providers ¶
type Providers struct { Authorizer *authorization.Authorizer SessionProvider *session.Provider Regulator *regulation.Regulator UserProvider authentication.UserProvider StorageProvider storage.Provider Notifier notification.Notifier }
Providers contain all provider provided to Authelia.
type RequestHandler ¶
type RequestHandler = func(*AutheliaCtx)
RequestHandler represents an Authelia request handler.
func IdentityVerificationFinish ¶
func IdentityVerificationFinish(args IdentityVerificationFinishArgs, next func(ctx *AutheliaCtx, username string)) RequestHandler
IdentityVerificationFinish the middleware for finishing the identity validation process.
func IdentityVerificationStart ¶
func IdentityVerificationStart(args IdentityVerificationStartArgs) RequestHandler
IdentityVerificationStart the handler for initiating the identity validation process.
func RequireFirstFactor ¶
func RequireFirstFactor(next RequestHandler) RequestHandler
RequireFirstFactor check if user has enough permissions to execute the next handler.