You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by fp...@apache.org on 2022/09/26 06:37:55 UTC

[shiro] 01/02: catch SessionException in getRunAsPrincipalsStack Fixes SHIRO-512

This is an automated email from the ASF dual-hosted git repository.

fpapon pushed a commit to branch 1.10.x
in repository https://gitbox.apache.org/repos/asf/shiro.git

commit 2765effd1820be8ad78948779926eb31905af6f5
Author: lprimak <le...@flowlogix.com>
AuthorDate: Sun Sep 4 22:15:46 2022 -0700

    catch SessionException in getRunAsPrincipalsStack
    Fixes SHIRO-512
---
 .../java/org/apache/shiro/subject/support/DelegatingSubject.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/shiro/subject/support/DelegatingSubject.java b/core/src/main/java/org/apache/shiro/subject/support/DelegatingSubject.java
index 406bec40..431c8464 100644
--- a/core/src/main/java/org/apache/shiro/subject/support/DelegatingSubject.java
+++ b/core/src/main/java/org/apache/shiro/subject/support/DelegatingSubject.java
@@ -470,7 +470,12 @@ public class DelegatingSubject implements Subject {
     private List<PrincipalCollection> getRunAsPrincipalsStack() {
         Session session = getSession(false);
         if (session != null) {
-            return (List<PrincipalCollection>) session.getAttribute(RUN_AS_PRINCIPALS_SESSION_KEY);
+            try {
+                return (List<PrincipalCollection>) session.getAttribute(RUN_AS_PRINCIPALS_SESSION_KEY);
+            } catch (SessionException se) {
+                log.debug("Encountered session exception trying to get 'runAs' principal stack.  This "
+                        + "can generally safely be ignored.", se);
+            }
         }
         return null;
     }