use of org.apache.shiro.authz.permission.WildcardPermission in project airpal by airbnb.
the class UserGroup method setPermissions.
public void setPermissions(Set<String> permissions) {
ImmutableSet.Builder<Permission> builder = ImmutableSet.builder();
for (String permission : permissions) {
builder.add(new WildcardPermission(permission));
}
this.permissions = builder.build();
}
use of org.apache.shiro.authz.permission.WildcardPermission in project camel by apache.
the class ShiroAuthorizationTest method createRouteBuilders.
@Override
protected RouteBuilder[] createRouteBuilders() throws Exception {
return new RouteBuilder[] { new RouteBuilder() {
public void configure() {
List<Permission> permissionsList = new ArrayList<Permission>();
Permission permission = new WildcardPermission("zone1:readwrite:*");
permissionsList.add(permission);
final ShiroSecurityPolicy securityPolicy = new ShiroSecurityPolicy("src/test/resources/securityconfig.ini", passPhrase, true, permissionsList);
onException(CamelAuthorizationException.class).to("mock:authorizationException");
from("direct:secureEndpoint").policy(securityPolicy).to("log:incoming payload").to("mock:success");
}
}, new RouteBuilder() {
public void configure() {
List<Permission> permissionsList = new ArrayList<Permission>();
Permission permission = new WildcardPermission("zone1:readonly:*");
permissionsList.add(permission);
permission = new WildcardPermission("zone1:writeonly:*");
permissionsList.add(permission);
final ShiroSecurityPolicy securityPolicy = new ShiroSecurityPolicy("src/test/resources/securityconfig.ini", passPhrase, true, permissionsList);
onException(CamelAuthorizationException.class).to("mock:authorizationException");
from("direct:secureAnyEndpoint").policy(securityPolicy).to("log:incoming payload").to("mock:success");
}
}, new RouteBuilder() {
public void configure() {
List<Permission> permissionsList = new ArrayList<Permission>();
Permission permission = new WildcardPermission("zone1:readonly:*");
permissionsList.add(permission);
permission = new WildcardPermission("zone1:writeonly:*");
permissionsList.add(permission);
final ShiroSecurityPolicy securityPolicy = new ShiroSecurityPolicy("src/test/resources/securityconfig.ini", passPhrase, true, permissionsList);
securityPolicy.setAllPermissionsRequired(true);
onException(CamelAuthorizationException.class).to("mock:authorizationException");
from("direct:secureAllEndpoint").policy(securityPolicy).to("log:incoming payload").to("mock:success");
}
} };
}
use of org.apache.shiro.authz.permission.WildcardPermission in project geode by apache.
the class ResourcePermissionTest method testIsPermission.
@Test
public void testIsPermission() {
context = new ResourcePermission();
assertTrue(context instanceof WildcardPermission);
}
use of org.apache.shiro.authz.permission.WildcardPermission in project geode by apache.
the class ResourcePermissionTest method testImples.
@Test
public void testImples() {
WildcardPermission role = new WildcardPermission("*:read");
role.implies(new ResourcePermission("data", "read"));
role.implies(new ResourcePermission("cluster", "read"));
role = new WildcardPermission("*:read:*");
role.implies(new ResourcePermission("data", "read", "testRegion"));
role.implies(new ResourcePermission("cluster", "read", "anotherRegion", "key1"));
role = new WildcardPermission("data:*:testRegion");
role.implies(new ResourcePermission("data", "read", "testRegion"));
role.implies(new ResourcePermission("data", "write", "testRegion"));
}
use of org.apache.shiro.authz.permission.WildcardPermission in project ddf by codice.
the class AuthzRealmTest method testIsWildcardPermitted.
@Test
public void testIsWildcardPermitted() {
permissionList.clear();
WildcardPermission kvp = new WildcardPermission("role:admin");
permissionList.add(kvp);
boolean[] permittedArray = testRealm.isPermitted(mockSubjectPrincipal, permissionList);
for (boolean permitted : permittedArray) {
Assert.assertEquals(true, permitted);
}
}
Aggregations