Search in sources :

Example 21 with CollectionPermission

use of ddf.security.permission.CollectionPermission in project ddf by codice.

the class WorkspacePolicyExtensionTest method testShouldRemoveRolesAndEmailsWhenEmailImplied.

@Test
public void testShouldRemoveRolesAndEmailsWhenEmailImplied() {
    List<Permission> before = ImmutableList.of(RANDOM, ROLES, EMAILS);
    doReturn(before).when(match).getPermissionList();
    CollectionPermission subject = subjectFrom(makePermission(Constants.EMAIL_ADDRESS_CLAIM_URI, VALUES));
    List<Permission> after = extension.isPermittedMatchAll(subject, match).getPermissionList();
    assertThat(after, is(ImmutableList.of(RANDOM)));
}
Also used : CollectionPermission(ddf.security.permission.CollectionPermission) KeyValuePermission(ddf.security.permission.KeyValuePermission) Permission(org.apache.shiro.authz.Permission) KeyValueCollectionPermission(ddf.security.permission.KeyValueCollectionPermission) CollectionPermission(ddf.security.permission.CollectionPermission) KeyValueCollectionPermission(ddf.security.permission.KeyValueCollectionPermission) Test(org.junit.Test)

Aggregations

CollectionPermission (ddf.security.permission.CollectionPermission)21 Test (org.junit.Test)16 KeyValueCollectionPermission (ddf.security.permission.KeyValueCollectionPermission)13 KeyValuePermission (ddf.security.permission.KeyValuePermission)12 Permission (org.apache.shiro.authz.Permission)10 Subject (ddf.security.Subject)5 SecurityAssertion (ddf.security.assertion.SecurityAssertion)5 SecurityManager (ddf.security.service.SecurityManager)4 Message (org.apache.cxf.message.Message)4 SecurityToken (org.apache.cxf.ws.security.tokenstore.SecurityToken)4 InvocationOnMock (org.mockito.invocation.InvocationOnMock)4 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)4 ArrayList (java.util.ArrayList)3 QName (javax.xml.namespace.QName)3 Exchange (org.apache.cxf.message.Exchange)3 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)3 ContextPolicy (org.codice.ddf.security.policy.context.ContextPolicy)3 PolicyExtension (ddf.security.policy.extension.PolicyExtension)2 List (java.util.List)2 ImmutableMap (com.google.common.collect.ImmutableMap)1