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

lprimak pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shiro.git


The following commit(s) were added to refs/heads/main by this push:
     new cde5990d5 bugfix: fix login() once again accepts null subject (#2807)
cde5990d5 is described below

commit cde5990d5e98e3518fe02cf9b42245c30b8cde87
Author: Lenny Primak <[email protected]>
AuthorDate: Thu Jul 9 09:47:08 2026 -0500

    bugfix: fix login() once again accepts null subject (#2807)
---
 core/src/main/java/org/apache/shiro/mgt/DefaultSecurityManager.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/core/src/main/java/org/apache/shiro/mgt/DefaultSecurityManager.java 
b/core/src/main/java/org/apache/shiro/mgt/DefaultSecurityManager.java
index 1a3ba503c..ebf05622f 100644
--- a/core/src/main/java/org/apache/shiro/mgt/DefaultSecurityManager.java
+++ b/core/src/main/java/org/apache/shiro/mgt/DefaultSecurityManager.java
@@ -305,7 +305,7 @@ public class DefaultSecurityManager extends 
SessionsSecurityManager {
      * @param subject Subject
      */
     protected void beforeSuccessfulLogin(Subject subject) {
-        Session session = subject.getSession(false);
+        Session session = subject != null ? subject.getSession(false) : null;
         if (session != null) {
             Map<Object, Object> attributes = new HashMap<>();
             session.getAttributeKeys().forEach(key -> attributes.put(key, 
session.getAttribute(key)));

Reply via email to