SIMJIYEON93 opened a new issue, #2069: URL: https://github.com/apache/shiro/issues/2069
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/shiro/issues?q=is%3Aissue) and found no similar issues. ### Environment Java 17 Apache Tomcat 9 Apache Shiro (latest master branch) OS: Windows 11 Build tool: Maven Tested against: master branch (after 1.13.0 release) ### Shiro version Apache Shiro (latest master branch, after 1.13.0 release) ### What was the actual outcome? If the principal in the AuthenticationToken is null, a NullPointerException could occur when calling `DefaultLdapRealm#getLdapPrincipal`. ### What was the expected outcome? An `AuthenticationException` should be thrown when the principal is null to prevent unexpected NPE. ### How to reproduce ```java @Test void testGetLdapPrincipalNullPrincipal() { AuthenticationToken token = new AuthenticationToken() { @Override public Object getPrincipal() { return null; } @Override public Object getCredentials() { return "secret"; } }; assertThrows(AuthenticationException.class, () -> { realm.getLdapPrincipal(token); }); } ### Debug logs No response ### Additional Information All changes were tested locally with `mvn verify` to ensure no regressions. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
