MrtnBalazs opened a new pull request, #624:
URL: https://github.com/apache/knox/pull/624

   ## What changes were proposed in this pull request?
   
   Changed the verifier, introduced a new function called `registerToken`, this 
function is checking the session limits for the given user and stores the  
given token. Changed `verifySessionForUser` function, now this function only 
checks the limit but do not store token. These changes were needed, because 
previously in case of an attack we would generate tokens needlessly before 
verifying the session and checking the limit. Now we check the limit without a 
token before token generation, so in case of an attack we do not waste 
resources. And we add the token after token generation and also check the limit 
because thread safety requires it.
   
   ## How was this patch tested?
   
   I have changed the unit tests in `InMemoryConcurrentSessionVerifierTest` and 
`WebSSOResourceTest` to test the new usage of the verifier.
   I also tested it manually with this configuration:
   ```
   <property>
           <name>gateway.session.verification.unlimited.users</name>
           <value>admin</value>
   </property>
   <property>
           <name>gateway.session.verification.privileged.users</name>
           <value>tom</value>
   </property>
   <property>
           <name>gateway.session.verification.privileged.user.limit</name>
           <value>2</value>
   </property>
   <property>
           <name>gateway.session.verification.non.privileged.user.limit</name>
           <value>1</value>
   </property>
   <property>
           
<name>gateway.session.verification.expired.tokens.cleaning.period</name>
           <value>80</value>
   </property>
   <property>
           <name>gateway.service.concurrentsessionverifier.impl</name>
           
<value>org.apache.knox.gateway.session.control.InMemoryConcurrentSessionVerifier</value>
   </property>
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to