[ 
https://issues.apache.org/jira/browse/SHIRO-875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17514638#comment-17514638
 ] 

Benjamin Marwell commented on SHIRO-875:
----------------------------------------

I’d say we are missing an if here:
https://github.com/apache/shiro/blob/1d7aea599f96e32e37e5696f4d530fd08cd78d10/core/src/main/java/org/apache/shiro/mgt/DefaultSecurityManager.java#L351-L356

{code:java}
       if (subjectContext.isSessionCreationEnabled()) {
            save(subject);
        }
{code}

> Cannot create subjects with principals and disabled session-creation
> --------------------------------------------------------------------
>
>                 Key: SHIRO-875
>                 URL: https://issues.apache.org/jira/browse/SHIRO-875
>             Project: Shiro
>          Issue Type: Bug
>    Affects Versions: 1.9.0
>            Reporter: Boris Petrov
>            Priority: Major
>
> {code:java}
> var principals = new SimplePrincipalCollection(123, "asd");
> var subject = new 
> Subject.Builder().principals(principals).sessionCreationEnabled(false).buildSubject();
> {code}
> This fails because the `DefaultSecurityManager` calls `save(subject);` which 
> in turn saves something to the session of the subject. But a session can't be 
> created so this blows up.
> Is this by design or is it a bug?



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to