You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by GitBox <gi...@apache.org> on 2019/05/09 17:32:53 UTC

[GitHub] [shiro] fpapon commented on a change in pull request #132: [SHIRO-685] Potential NullPointerException if PermissionResolver retu…

fpapon commented on a change in pull request #132: [SHIRO-685] Potential NullPointerException if PermissionResolver retu…
URL: https://github.com/apache/shiro/pull/132#discussion_r282588719
 
 

 ##########
 File path: core/src/test/java/org/apache/shiro/realm/AuthorizingRealmTest.java
 ##########
 @@ -214,6 +228,36 @@ public void testRealmWithRolePermissionResolver()
         assertTrue( realm.isPermitted( pCollection, "other:bar:foo" ) );
     }
 
+    @Test
+    public void testRealmWithEmptyOrNullPermissions() {
+        Principal principal = new UsernamePrincipal("rolePermResolver");
+        PrincipalCollection pCollection = new SimplePrincipalCollection(principal, "testRealmWithRolePermissionResolver");
+
+        AuthorizingRealm realm = new AllowAllRealm();
+        realm.setRolePermissionResolver( new RolePermissionResolver()
+        {
+            public Collection<Permission> resolvePermissionsInRole( String roleString )
+            {
+                Collection<Permission> permissions = new HashSet<Permission>();
+                if( roleString.equals( ROLE ))
+                {
+                    permissions.add( new WildcardPermission( ROLE + ":perm1" ) );
+                    permissions.add( new WildcardPermission( ROLE + ":perm2" ) );
+                    permissions.add( new WildcardPermission( "other:*:foo" ) );
 
 Review comment:
   @bdemers done :)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services