• 
      

    Respect User.is_active when logging in with SAML SSO.

    Review Request #14331 — Created Feb. 6, 2025 and submitted

    Information

    Review Board
    release-6.x

    Reviewers

    When we built the SSO support, we made the assumption that all user
    management would happen on the IdP side. We've had a report of a user
    that wants to connect their IdP generally, but selectively mark users as
    active or not on the Review Board side.

    This change makes it so the SAML ACS and link-user views check the
    is_active flag. In the link-user flow, we rely on the authentication
    view/form to show the same error that someone would get if they were
    logging in with a username and password. In the ACS flow, we just
    redirect to a permission denied page.

    While writing tests for this, things were getting a little unwieldy, so
    I split up the SAML view tests into separate classes.

    • Set my user account to inactive and tried to log in with SAML. Saw
      that things worked as expected.
    • Ran unit tests.
    Summary ID
    Respect User.is_active when logging in with SAML SSO.
    When we built the SSO support, we made the assumption that all user management would happen on the IdP side. We've had a report of a user that wants to connect their IdP generally, but selectively mark users as active or not on the Review Board side. This change makes it so the SAML ACS and link-user views check the `is_active` flag. In the link-user flow, we rely on the authentication view/form to show the same error that someone would get if they were logging in with a username and password. In the ACS flow, we just redirect to a permission denied page. While writing tests for this, things were getting a little unwieldy, so I split up the SAML view tests into separate classes. Testing Done: - Set my user account to inactive and tried to log in with SAML. Saw that things worked as expected. - Ran unit tests.
    b39328342a3e5456f66b3ed0b2ba8e3a3e3bef41
    Description From Last Updated

    'reviewboard.accounts.models.LinkedAccount' imported but unused Column: 1 Error code: F401

    reviewbot reviewbot

    expected 2 blank lines, found 1 Column: 1 Error code: E302

    reviewbot reviewbot

    expected 2 blank lines, found 1 Column: 1 Error code: E302

    reviewbot reviewbot

    Since they're targeting a 7.0.3 upgrade, I'm tempted to say let's just target 7.0.4 for this.

    chipx86 chipx86

    We should be localizing the errors.

    chipx86 chipx86

    Doesn't this type to forms.BooleanField automatically?

    chipx86 chipx86
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    david
    chipx86
    1. Looks great. Couple small things.

    2. reviewboard/accounts/errors.py (Diff revision 2)
       
       
       
      Show all issues

      Since they're targeting a 7.0.3 upgrade, I'm tempted to say let's just target 7.0.4 for this.

      1. I'm not sure when that's planned for, and this seems generally useful for larger, more upgrade-shy orgs anyway.

    3. reviewboard/accounts/errors.py (Diff revision 2)
       
       
      Show all issues

      We should be localizing the errors.

    4. Show all issues

      Doesn't this type to forms.BooleanField automatically?

      1. It seems like the general consensus I'm seeing on this topic is that it does, but best practice is to add an annotation for things unless the class is decorated with @final.

    5. 
        
    david
    chipx86
    1. Ship It!
    2. 
        
    maubin
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-6.x (07115dc)