2019-04-24 21:52:08 +00:00
|
|
|
package middlewares
|
|
|
|
|
|
|
|
import (
|
2019-12-24 02:14:52 +00:00
|
|
|
"github.com/authelia/authelia/internal/authentication"
|
2019-04-24 21:52:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// RequireFirstFactor check if user has enough permissions to execute the next handler.
|
|
|
|
func RequireFirstFactor(next RequestHandler) RequestHandler {
|
|
|
|
return func(ctx *AutheliaCtx) {
|
|
|
|
if ctx.GetSession().AuthenticationLevel < authentication.OneFactor {
|
|
|
|
ctx.ReplyForbidden()
|
|
|
|
return
|
|
|
|
}
|
2020-05-05 19:35:32 +00:00
|
|
|
|
2019-04-24 21:52:08 +00:00
|
|
|
next(ctx)
|
|
|
|
}
|
|
|
|
}
|