2019-12-07 23:40:42 +07:00
|
|
|
package handlers
|
|
|
|
|
2020-06-21 20:40:37 +07:00
|
|
|
import (
|
2021-08-11 08:04:35 +07:00
|
|
|
"github.com/authelia/authelia/v4/internal/middlewares"
|
2020-06-21 20:40:37 +07:00
|
|
|
)
|
2019-12-07 23:40:42 +07:00
|
|
|
|
2022-04-08 11:13:47 +07:00
|
|
|
// ConfigurationGET get the configuration accessible to authenticated users.
|
|
|
|
func ConfigurationGET(ctx *middlewares.AutheliaCtx) {
|
2022-03-03 18:20:43 +07:00
|
|
|
body := configurationBody{
|
|
|
|
AvailableMethods: make(MethodList, 0, 3),
|
2019-12-07 23:40:42 +07:00
|
|
|
}
|
2020-06-21 20:40:37 +07:00
|
|
|
|
2022-03-03 18:20:43 +07:00
|
|
|
if ctx.Providers.Authorizer.IsSecondFactorEnabled() {
|
2022-03-28 08:26:30 +07:00
|
|
|
body.AvailableMethods = ctx.AvailableSecondFactorMethods()
|
2022-03-03 18:20:43 +07:00
|
|
|
}
|
2021-06-18 08:38:01 +07:00
|
|
|
|
2020-06-21 20:40:37 +07:00
|
|
|
ctx.Logger.Tracef("Available methods are %s", body.AvailableMethods)
|
2020-12-16 08:47:31 +07:00
|
|
|
|
2022-03-03 18:20:43 +07:00
|
|
|
if err := ctx.SetJSONBody(body); err != nil {
|
2020-12-16 08:47:31 +07:00
|
|
|
ctx.Logger.Errorf("Unable to set configuration response in body: %s", err)
|
|
|
|
}
|
2019-12-07 23:40:42 +07:00
|
|
|
}
|