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

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

There was an API breaking change: 
https://github.com/apache/shiro/commit/f4855e5b8982dd3f8225ede9a3f3195c5414c7c2

I guess all you can do is:

1. Rename it if you use it in a manner different than the method in 
ActiveDirectoryRealm
or
2. Make it protected as well.

I do not think it can be made private again, now that it is published. Perhaps 
when you were using Shiro 1.3.x, you chose the method signature by chance.

Do you have more methods in your calls? Are they calling the method you 
mentioned here?

> 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