Skip to content

Commit 78330b9

Browse files
feat(authentik): Add MFA (TOTP) support (#1440)
This change adds support for optional usage of MFA authenticator for IdP Authentik, Without this change it is not possible to use authentik provider when MFA like TOTP is configured for a user. Without this added support the only workaround is to use browser.
1 parent 36983fb commit 78330b9

3 files changed

Lines changed: 702 additions & 2 deletions

File tree

pkg/provider/authentik/authentik.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,14 @@ func getLoginJSON(loginDetails *creds.LoginDetails, payload *authentikPayload) (
215215
switch component {
216216
case "ak-stage-identification":
217217
m["uid_field"] = loginDetails.Username
218-
if payload.HasPassowrdField {
218+
if payload.HasPasswordField {
219219
m["password"] = loginDetails.Password
220220
}
221221
case "ak-stage-password":
222222
m["password"] = loginDetails.Password
223+
224+
case "ak-stage-authenticator-validate":
225+
m["code"] = loginDetails.MFAToken
223226
default:
224227
return []byte(""), errors.New("unknown component: " + component)
225228
}
@@ -260,6 +263,9 @@ func prepareErrors(component string, errs map[string][]map[string]string) string
260263
if field == "password" {
261264
key = "password"
262265
}
266+
if field == "authenticator-validate" {
267+
key = "code"
268+
}
263269
msgs := make([]string, 0, len(errs[key]))
264270
for _, err := range errs[key] {
265271
msgs = append(msgs, fmt.Sprintf("%s %s: %s", field, err["code"], err["string"]))

0 commit comments

Comments
 (0)