duncangrant commented on a change in pull request #1079: Adding logic to manage 
a max session age
URL: https://github.com/apache/brooklyn-server/pull/1079#discussion_r365315647
 
 

 ##########
 File path: 
rest/rest-resources/src/main/java/org/apache/brooklyn/rest/filter/BrooklynSecurityProviderFilterHelper.java
 ##########
 @@ -126,15 +134,24 @@ public void run(HttpServletRequest webRequest, 
ManagementContext mgmt) throws Se
             }
         }
         
-        Supplier<HttpSession> sessionSupplier = () -> preferredSession1!=null 
? preferredSession1 : MultiSessionAttributeAdapter.of(webRequest, 
true).getPreferredSession();
-        if (provider.authenticate(webRequest, sessionSupplier, user, pass)) {
-            HttpSession preferredSession2 = sessionSupplier.get();
-            log.trace("{} authentication successful - {}", this, 
preferredSession2);
-            
preferredSession2.setAttribute(BrooklynWebConfig.REMOTE_ADDRESS_SESSION_ATTRIBUTE,
 webRequest.getRemoteAddr());
-            if (user != null) {
-                
preferredSession2.setAttribute(AUTHENTICATED_USER_SESSION_ATTRIBUTE, user);
+        Supplier<HttpSession> sessionSupplier = () -> {
+            return preferredSession1 != null ? preferredSession1 : 
MultiSessionAttributeAdapter.of(webRequest, true).getPreferredSession();
+        };
+
+        try{
+            if (provider.authenticate(webRequest, sessionSupplier, user, 
pass)) {
+                // get new created session after authentication
+                Supplier<HttpSession> authenticatedSessionSupplier = () -> 
MultiSessionAttributeAdapter.of(webRequest, false).getPreferredSession();
 
 Review comment:
   Actually - why does this lambda even exist?  Can't you just make the call.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to