Coder Social home page Coder Social logo

Comments (6)

pennersr avatar pennersr commented on August 17, 2024

Is the user supposed to be anonymous?

Yes. If you have not passed all checks (email verification if mandatory, 2FA if enabled, ...) request.user remains an anonymous user. That is done intentionally -- it would be really insecure if that would not be the case, as any third-party code typically checks for request.user.is_authenticated and assumes that is sufficient, which is not the case.

I must admit, I don't fully understand what you are trying to accomplish:

set a timeout between initial login and mfa

This is not clear to me.

from django-allauth.

half-of-a-glazier avatar half-of-a-glazier commented on August 17, 2024

When the mfa form is filled out it should check how long ago the login form was submitted. If it's longer than x seconds, it should timeout and restart the login process.

from django-allauth.

pennersr avatar pennersr commented on August 17, 2024

What's the difference with what you are aiming for, versus what settings.ACCOUNT_REAUTHENTICATION_TIMEOUT is already doing?

from django-allauth.

half-of-a-glazier avatar half-of-a-glazier commented on August 17, 2024

ACCOUNT_REAUTHENTICATION_TIMEOUT (default: 300)
Before asking the user to reauthenticate, we check if a successful (re)authentication happened within the amount of seconds specified here, and if that is the case, the new reauthentication flow is silently skipped.

This is what should happen:

  1. User is logged out
  2. User submits the login form with username/password and is redirected to mfa form
  3. User waits 5 minutes
  4. User submits mfa form
  5. Since 5 minutes is longer than the mfa-timeout limit, user is redirected to login stage 1.

settings.ACCOUNT_REAUTHENTICATION_TIMEOUT doesn't enforce this timeout because the user hasn't completed a successful authentication yet.

from django-allauth.

pennersr avatar pennersr commented on August 17, 2024

I see. In that case:

This function in allauth.account.reauthentication that looks like it's intended for this:

It's not -- the user did not (fully) authenticate yet, so reauthentication is not applicable. In order to support this, I think a general mechanism is needed to add timeouts to class LoginStage.

from django-allauth.

pennersr avatar pennersr commented on August 17, 2024

Logins now have a time out, see: 63bc165

from django-allauth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.