Use a Shiro 2 supported hash for LdapRealm credentials by zeotuan · Pull Request #5579 · apache/zeppelin · GitHub
Skip to content

Use a Shiro 2 supported hash for LdapRealm credentials - #5579

Open
zeotuan wants to merge 1 commit into
apache:masterfrom
zeotuan:fix-ldap-realm-credential-hash
Open

zeotuan wants to merge 1 commit into
apache:masterfrom
zeotuan:fix-ldap-realm-credential-hash

Conversation

@zeotuan

@zeotuan zeotuan commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

What is this PR for?

Since the Shiro 2 upgrade (#5293), LdapRealm cannot authenticate anyone. createAuthenticationInfo hashes the credentials with SHA-1, which Shiro 2 DefaultHashService no longer supports:

java.lang.UnsupportedOperationException: Cannot create a hash with the given algorithm: SHA-1

Change:

  • Hash with SHA-256 and 50,000 iterations.
  • Set the same iterations on the HashedCredentialsMatcher, so the matcher and the stored hash agree.

The hash is only used in memory to compare the submitted password with the cached authentication info, so nothing persisted is affected.

What type of PR is it?

Bug Fix

Todos

  • - Jira issue

What is the Jira issue?

  • TBD

How should this be tested?

LdapRealmTest.testAuthenticationInfoCredentialsMatch: the correct password matches, a wrong one does not. Fails on master with the exception above.

./mvnw package -pl zeppelin-server --am -Dtest='LdapRealm*Test' -Dsurefire.failIfNoSpecifiedTests=false

Screenshots (if appropriate)

N/A

Questions:

  • Does the license files need to update? No
  • Is there breaking changes for older versions? No
  • Does this needs documentation? No

Shiro 2 DefaultHashService rejects SHA-1, so LdapRealm.createAuthenticationInfo
threw UnsupportedOperationException and every LDAP login failed. Hash with
SHA-256 and 50,000 iterations, matching the credentials matcher.
@zeotuan zeotuan changed the title [ZEPPELIN-XXXX] Use a Shiro 2 supported hash for LdapRealm credentials Use a Shiro 2 supported hash for LdapRealm credentials Oct 21, 2026
@zeotuan
zeotuan marked this pull request as ready for review October 21, 2026 10:07

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant