2019-12-07 23:40:42 +07:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
2019-12-24 09:14:52 +07:00
|
|
|
"github.com/authelia/authelia/internal/authentication"
|
|
|
|
"github.com/authelia/authelia/internal/middlewares"
|
2019-12-07 23:40:42 +07:00
|
|
|
)
|
|
|
|
|
|
|
|
type ExtendedConfigurationBody struct {
|
|
|
|
AvailableMethods MethodList `json:"available_methods"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExtendedConfigurationGet get the extended configuration accessbile to authenticated users.
|
|
|
|
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)
|
|
|
|
}
|