Search in sources :

Example 6 with UserPrincipal

use of org.apache.activemq.artemis.spi.core.security.jaas.UserPrincipal in project activemq-artemis by apache.

the class UserPrincipalTest method testHash.

@Test
public void testHash() {
    UserPrincipal p1 = new UserPrincipal("FOO");
    UserPrincipal p2 = new UserPrincipal("FOO");
    assertEquals(p1.hashCode(), p1.hashCode());
    assertEquals(p1.hashCode(), p2.hashCode());
}
Also used : UserPrincipal(org.apache.activemq.artemis.spi.core.security.jaas.UserPrincipal) Test(org.junit.Test)

Example 7 with UserPrincipal

use of org.apache.activemq.artemis.spi.core.security.jaas.UserPrincipal in project activemq-artemis by apache.

the class UserPrincipalTest method testEquals.

@Test
public void testEquals() {
    UserPrincipal p1 = new UserPrincipal("FOO");
    UserPrincipal p2 = new UserPrincipal("FOO");
    UserPrincipal p3 = new UserPrincipal("BAR");
    assertTrue(p1.equals(p1));
    assertTrue(p1.equals(p2));
    assertFalse(p1.equals(null));
    assertFalse(p1.equals("FOO"));
    assertFalse(p1.equals(p3));
}
Also used : UserPrincipal(org.apache.activemq.artemis.spi.core.security.jaas.UserPrincipal) Test(org.junit.Test)

Aggregations

UserPrincipal (org.apache.activemq.artemis.spi.core.security.jaas.UserPrincipal)7 Test (org.junit.Test)5 RolePrincipal (org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal)3 IOException (java.io.IOException)2 Subject (javax.security.auth.Subject)2 Callback (javax.security.auth.callback.Callback)2 CallbackHandler (javax.security.auth.callback.CallbackHandler)2 UnsupportedCallbackException (javax.security.auth.callback.UnsupportedCallbackException)2 LoginContext (javax.security.auth.login.LoginContext)2 Principal (java.security.Principal)1