Search in sources :

Example 1 with GroupWrapper

use of org.apache.cxf.interceptor.security.test.GroupWrapper in project cxf by apache.

the class DeprecatedSecurityContextTest method testPrivateStaticGroup.

@Test
public void testPrivateStaticGroup() {
    Subject s = new Subject();
    Principal p = new SimplePrincipal("Barry");
    s.getPrincipals().add(p);
    // create a friend group and add Barry to this group
    GroupWrapper test = new GroupWrapper("friend", "Barry");
    s.getPrincipals().add(test.getGroup());
    LoginSecurityContext context = new DefaultSecurityContext(p, s);
    assertTrue(context.isUserInRole("Barry"));
}
Also used : GroupWrapper(org.apache.cxf.interceptor.security.test.GroupWrapper) LoginSecurityContext(org.apache.cxf.security.LoginSecurityContext) Subject(javax.security.auth.Subject) SimplePrincipal(org.apache.cxf.common.security.SimplePrincipal) Principal(java.security.Principal) SimplePrincipal(org.apache.cxf.common.security.SimplePrincipal) Test(org.junit.Test)

Aggregations

Principal (java.security.Principal)1 Subject (javax.security.auth.Subject)1 SimplePrincipal (org.apache.cxf.common.security.SimplePrincipal)1 GroupWrapper (org.apache.cxf.interceptor.security.test.GroupWrapper)1 LoginSecurityContext (org.apache.cxf.security.LoginSecurityContext)1 Test (org.junit.Test)1