Hello, I am implementing MFA, specifically TOTP. T...
# talk-kratos
l
Hello, I am implementing MFA, specifically TOTP. TOTP should be mandatory, so right after registration (I use OIDC with Google as the provider ) a user should be prompted to add Google authenticator and on each sign-in they should type the code from the Google Authenticator app. I have set:
Copy code
methods:
    totp:
      enabled: true
      config:
        issuer: Ory Demo

session:
  whoami:
    required_aal: highest_available
But now, users can normally sign-in/sign-up via OIDC and are never prompted to link the TOTP app. Why is TOTP not enabled? Based on the information in the docs, it should be enabled by now.
s
We're also struggling with this exact same hurdle. How do you restrict access for a user if they haven't setup
f2a
? It doesn't seem logical to do this on the front-end, right?
Copy code
ory.frontend
      .createBrowserLoginFlow({
        refresh: Boolean(refresh),
        aal: aal ? String(aal) : undefined,
        returnTo: returnTo ? String(returnTo) : undefined,
      })
We figured it out 💪 It wasn't very clear that the need for
f2a
isn't "forced", but happens on request. So you can ask a user to fill in their f2a. For example, after logging in, you want to check if the user has
faa2
and if they don't, you can redirect them and let them fill it in
l
Hey @stale-queen-97584 So, you are suggesting to check if the user has the required aal level on each request. So I would need a wrapper on top Kratos's of /sessions/whoami on my backend. Did I understand you correctly?
s
Well, obviously I don't know what you're using it for, but the idea doesn't seem to be that you can't login without f2a, but that you can't access whatever source you want to share without the f2a
So, probably, in your software, you're currently checking if someone is logged in, but you should also check if they have f2a
l
Yeah, that seems correct. So we would allow a user to log in without 2fa, but to access any endpoint, we would require to have a session with completed 2fa (totp)
s
@lemon-apartment-14887 hola. I believe there is another step to account for. So you can actually configure Kratos to demand 2fa for the
whoami
and
settings
page. It's the same concept - the API checks whether the user needs 2fa. This results in the
whoami
giving a 403 when the user isn't authenticated with 2fa