Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-16991

Concurrent requests failing JWT Auth intermittently

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • None
    • 9.4
    • Authentication
    • None

    Description

      There's an intermittent failure in JWT authentication, with a roughly 20% failure rate (depends on the network latency). Upon investigating, I identified a race condition due to simultaneous HTTP requests within the authentication process. Here's the chain of events:

      1. The user initiates the OAuth/IdProvider authentication process. Once completed, they are redirected back to Solr.
      1. LoginController is then activated to handle the response from the IdProvider.
      1. LoginController calls "resetMenu" method which triggers requests to the "admin/info/system" and "admin/cores" endpoints. These requests are bound to fail as the auth.header hasn't been set yet.
      1. The authentication process continues with the processing of the IdProvider's response. If successful, the auth.header is set.
      1. The response from step 3 is received and returns a 401 error, causing the auth.header to be unset in app.js.
      1. This results in the session being terminated and the entire authentication process failing.

      This race condition, where requests are made before setting the authentication header and their subsequent failure clears an already set header, leads to the observed intermittent authentication issues.

      Is the "resetMenu" call necessary ? My inclination is that this is useless because why would you need to reset the menu in the middle of an authentication process? All we need is either show or hide the menu depending on the existence or not of an active  user session. The menu would be reset after the user is authenticated.

      Replaced the call to resetMenu with a call to a newly added method showHideMenu and it worked nicely.

       

       $scope.showHideMenu = function() {
          $scope.http401 = sessionStorage.getItem("http401");
        };
      

       

      Attachments

        Issue Links

          Activity

            People

              janhoy Jan Høydahl
              Idjeraoui Lamine
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h