Allow loginflows based on config

This commit is contained in:
KuhnChris 2023-07-03 14:45:02 +02:00
parent 272f3cc2cc
commit eb51b1d24e

View file

@ -47,14 +47,16 @@ func Login(
cfg *config.ClientAPI,
) util.JSONResponse {
if req.Method == http.MethodGet {
var loginFlows []flow
loginFlows = []flow{{Type: authtypes.LoginTypePassword}}
if len(cfg.Derived.ApplicationServices) == 0 {
loginFlows = append(loginFlows, flow{Type: authtypes.LoginTypeApplicationService})
}
// TODO: support other forms of login, depending on config options
return util.JSONResponse{
Code: http.StatusOK,
JSON: flows{
Flows: []flow{
{Type: authtypes.LoginTypePassword},
{Type: authtypes.LoginTypeApplicationService},
},
Flows: loginFlows,
},
}
} else if req.Method == http.MethodPost {