mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
70ab8aab15
This ensures that; the method set when a user does not have a preference is a method that is available, that if a user has a preferred method that is not available it is changed to an enabled method with preference put on methods the user has configured, that the frontend does not show the method selection option when only one method is available.
23 lines
613 B
Go
23 lines
613 B
Go
package handlers
|
|
|
|
import (
|
|
"github.com/authelia/authelia/v4/internal/middlewares"
|
|
)
|
|
|
|
// ConfigurationGet get the configuration accessible to authenticated users.
|
|
func ConfigurationGet(ctx *middlewares.AutheliaCtx) {
|
|
body := configurationBody{
|
|
AvailableMethods: make(MethodList, 0, 3),
|
|
}
|
|
|
|
if ctx.Providers.Authorizer.IsSecondFactorEnabled() {
|
|
body.AvailableMethods = ctx.AvailableSecondFactorMethods()
|
|
}
|
|
|
|
ctx.Logger.Tracef("Available methods are %s", body.AvailableMethods)
|
|
|
|
if err := ctx.SetJSONBody(body); err != nil {
|
|
ctx.Logger.Errorf("Unable to set configuration response in body: %s", err)
|
|
}
|
|
}
|