shiro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdem...@apache.org
Subject [1/3] shiro git commit: SHIRO-637: Refresh cached session in HTTP request when its state changes
Date Wed, 02 May 2018 16:45:10 GMT
Repository: shiro
Updated Branches:
  refs/heads/master 9dfed7d2e -> f782eb108


SHIRO-637: Refresh cached session in HTTP request when its state changes


Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/2105c1b6
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/2105c1b6
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/2105c1b6

Branch: refs/heads/master
Commit: 2105c1b6a89d41f546ab24eea69e5db6186001df
Parents: f326fd3
Author: kp <philipp.kapfer@sprecher-automation.com>
Authored: Tue Oct 24 11:11:20 2017 +0200
Committer: kp <philipp.kapfer@sprecher-automation.com>
Committed: Tue Oct 24 11:11:20 2017 +0200

----------------------------------------------------------------------
 .../apache/shiro/web/servlet/ShiroHttpServletRequest.java   | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/2105c1b6/web/src/main/java/org/apache/shiro/web/servlet/ShiroHttpServletRequest.java
----------------------------------------------------------------------
diff --git a/web/src/main/java/org/apache/shiro/web/servlet/ShiroHttpServletRequest.java b/web/src/main/java/org/apache/shiro/web/servlet/ShiroHttpServletRequest.java
index 6b71250..072f2af 100644
--- a/web/src/main/java/org/apache/shiro/web/servlet/ShiroHttpServletRequest.java
+++ b/web/src/main/java/org/apache/shiro/web/servlet/ShiroHttpServletRequest.java
@@ -151,16 +151,17 @@ public class ShiroHttpServletRequest extends HttpServletRequestWrapper
{
                 }
             }
         } else {
-            if (this.session == null) {
-
-                boolean existing = getSubject().getSession(false) != null;
-
+            boolean existing = getSubject().getSession(false) != null;
+            
+            if (this.session == null || !existing) {
                 Session shiroSession = getSubject().getSession(create);
                 if (shiroSession != null) {
                     this.session = new ShiroHttpSession(shiroSession, this, this.servletContext);
                     if (!existing) {
                         setAttribute(REFERENCED_SESSION_IS_NEW, Boolean.TRUE);
                     }
+                } else if (this.session != null) {
+                    this.session = null;
                 }
             }
             httpSession = this.session;


Mime
View raw message