[ 
https://issues.apache.org/jira/browse/SHIRO-737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17018388#comment-17018388
 ] 

Benjamin Marwell commented on SHIRO-737:
----------------------------------------

Also, when looking at your code, I thing you should have filled a feature 
request long ago, where the attribute name for groups should be made 
configurable. That would save you time to see if anything in the method has 
changed everytime you upgrade shiro.

Do you also think this would be helpful?

> 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
>            Priority: Major
>
> 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)

Reply via email to