You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "xia0c (Jira)" <ji...@apache.org> on 2020/01/17 22:06:00 UTC
[jira] [Created] (SHIRO-737) Updating from 1.3.X to 1.4.X breaks
xia0c created SHIRO-737:
---------------------------
Summary: Updating from 1.3.X to 1.4.X breaks
Key: SHIRO-737
URL: https://issues.apache.org/jira/browse/SHIRO-737
Project: Shiro
Issue Type: Bug
Reporter: xia0c
When I try to upgrade shiro-core from 1.3.X to 1.4.X. The following code breaks.
{code:java}
public class TestShiro extends ActiveDirectoryRealm{
private Set<String> getRoleNamesForUser(String username, LdapContext ldapContext) throws NamingException {
Set<String> roleNames;
roleNames = new LinkedHashSet<String>();
SearchControls searchCtls = new SearchControls();
searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
String userPrincipalName = username;
if (principalSuffix != null) {
userPrincipalName += principalSuffix;
}
String searchFilter = "(&(objectClass=*)(entryDN={0}))";
Object[] searchArguments = new Object[]{userPrincipalName};
NamingEnumeration answer = ldapContext.search(searchBase, searchFilter, searchArguments, searchCtls);
while (answer.hasMoreElements()) {
SearchResult sr = (SearchResult) answer.next();
Attributes attrs = sr.getAttributes();
if (attrs != null) {
NamingEnumeration ae = attrs.getAll();
while (ae.hasMore()) {
Attribute attr = (Attribute) ae.next();
if (attr.getID().equals("ftRA")) {
//if (attr.getID().equals("memberOf")) {
Collection<String> groupNames = LdapUtils.getAllAttributeValues(attr);
Collection<String> rolesForGroups = getRoleNamesForGroups(groupNames);
roleNames.addAll(rolesForGroups);
}
}
}
}
return roleNames;
}
}
{code}
The code should pass, but it throws an error:
{code:java}
TestShiro.java:[22,25] getRoleNamesForUser(java.lang.String,javax.naming.ldap.LdapContext) in UTD.SeLab.BBI2.TestShiro cannot override getRoleNamesForUser(java.lang.String,javax.naming.ldap.LdapContext) in org.apache.shiro.realm.activedirectory.ActiveDirectoryRealm
[ERROR] attempting to assign weaker access privileges; was protected
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)