Repository navigation
Conversation
Shiro's Ini parser keeps quotes for String properties, so `ldapRealm.defaultRole = "role1,role2"` produced the role names `"role1` and `role2"`. Strip surrounding quotes when resolving role names, and correct the Javadoc example to show an unquoted defaultRole. Quotes are still required for rolesByUsername values that contain a comma. Add tests for quoted defaultRole and rolesByUsername values, including the shiro.ini parsing path.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shiro's Ini parser keeps quotes for String properties, so
ldapRealm.defaultRole = "role1,role2"produced the role names"role1androle2". Strip surrounding quotes when resolving role names, and correct the Javadoc example to show an unquoted defaultRole. Quotes are still required for rolesByUsername values that contain a comma.Add tests for quoted defaultRole and rolesByUsername values, including the shiro.ini parsing path.
What is this PR for?
This is a follow-up fix to ZEPPELIN-6295. Shiro's Ini parser does not strip quotes from String properties, so configuring ldapRealm.defaultRole = "role1,role2" passed the literal value "role1,role2" to setDefaultRole(). After splitting on commas, the realm returned the role names "role1 and role2" (including the quote characters), so role checks such as subject.hasRole("role1") failed.
This PR strips surrounding quotes from each resolved role name, corrects the Javadoc example to use an unquoted defaultRole, and documents that quotes are still required for rolesByUsername values containing a comma because the map entries themselves are comma-separated. Regression tests cover quoted and unquoted configurations, including the actual shiro.ini parsing path.
What type of PR is it?
Hot fix
Todos
What is the Jira issue?
[ZEPPELIN-6295]
How should this be tested?
Run the affected unit tests:
./mvnw test -pl zeppelin-server -am -Dtest=RoleMappingLdapRealmTest
Screenshots (if appropriate)
Questions: