2019-04-25 04:52:08 +07:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
2019-11-17 17:47:07 +07:00
|
|
|
"github.com/clems4ever/authelia/internal/authentication"
|
|
|
|
"github.com/clems4ever/authelia/internal/middlewares"
|
2019-04-25 04:52:08 +07:00
|
|
|
)
|
|
|
|
|
|
|
|
// SecondFactorAvailableMethodsGet retrieve available 2FA methods.
|
|
|
|
// The supported methods are: "totp", "u2f", "duo"
|
|
|
|
func SecondFactorAvailableMethodsGet(ctx *middlewares.AutheliaCtx) {
|
|
|
|
availableMethods := MethodList{authentication.TOTP, authentication.U2F}
|
|
|
|
|
|
|
|
if ctx.Configuration.DuoAPI != nil {
|
|
|
|
availableMethods = append(availableMethods, authentication.DuoPush)
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx.Logger.Debugf("Available methods are %s", availableMethods)
|
|
|
|
ctx.SetJSONBody(availableMethods)
|
|
|
|
}
|