Hi Apache Shiro community.

I hope you are doing well.

I have submitted a pull request to fix a potential NullPointerException
(NPE) in `DefaultLdapRealm#getLdapPrincipal`, where the
`AuthenticationToken`'s principal could be null.
Additionally, I updated the JavaDoc to clarify this behavior and added a
new unit test to verify the fix.

- PR Link: https://github.com/apache/shiro/pull/2066

**Summary of Changes**
- Explicitly throw an `AuthenticationException` when the principal is null
to prevent unexpected NPEs.
- Update JavaDocs for `getLdapPrincipal()` and
`queryForAuthenticationInfo()` to document the behavior clearly.
- Add a unit test (`testGetLdapPrincipalNullPrincipal`) in
`DefaultLdapRealmTest.java` to verify the change.

This is a small fix and no JIRA issue was created.
If necessary, I am happy to create a GitHub issue to formally track it.

I tested the changes locally with `mvn verify` and confirmed that all tests
pass.

Thank you very much for reviewing this pull request! 🙏

Best regards,
SIMJIYEON93

Reply via email to