2019-12-07 16:40:42 +00:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
2019-12-24 02:14:52 +00:00
|
|
|
"github.com/authelia/authelia/internal/authentication"
|
|
|
|
"github.com/authelia/authelia/internal/middlewares"
|
2019-12-07 16:40:42 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ExtendedConfigurationBody struct {
|
|
|
|
AvailableMethods MethodList `json:"available_methods"`
|
|
|
|
}
|
|
|
|
|
2020-01-05 23:03:16 +00:00
|
|
|
// ExtendedConfigurationGet get the extended configuration accessible to authenticated users.
|
2019-12-07 16:40:42 +00:00
|
|
|
func ExtendedConfigurationGet(ctx *middlewares.AutheliaCtx) {
|
|
|
|
body := ExtendedConfigurationBody{}
|
|
|
|
body.AvailableMethods = MethodList{authentication.TOTP, authentication.U2F}
|
|
|
|
|
|
|
|
if ctx.Configuration.DuoAPI != nil {
|
|
|
|
body.AvailableMethods = append(body.AvailableMethods, authentication.Push)
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx.Logger.Debugf("Available methods are %s", body.AvailableMethods)
|
|
|
|
ctx.SetJSONBody(body)
|
|
|
|
}
|