Search in sources :

Example 31 with AuthenticationInfo

use of org.apache.sling.auth.core.spi.AuthenticationInfo in project sling by apache.

the class AuthenticationInfoTest method testAuthenticationInfoStringStringCharArrayString.

@Test
public void testAuthenticationInfoStringStringCharArrayString() {
    final char[] pwd = new char[6];
    final AuthenticationInfo info = new AuthenticationInfo("test", "name", pwd);
    Assert.assertEquals("test", info.getAuthType());
    Assert.assertEquals("name", info.getUser());
    assertSame(pwd, info.getPassword());
}
Also used : AuthenticationInfo(org.apache.sling.auth.core.spi.AuthenticationInfo) Test(org.junit.Test)

Example 32 with AuthenticationInfo

use of org.apache.sling.auth.core.spi.AuthenticationInfo in project sling by apache.

the class AuthenticationInfoTest method testAuthenticationInfoStringStringCharArray.

@Test
public void testAuthenticationInfoStringStringCharArray() {
    final char[] pwd = new char[6];
    final AuthenticationInfo info = new AuthenticationInfo("test", "name", pwd);
    Assert.assertEquals("test", info.getAuthType());
    Assert.assertEquals("name", info.getUser());
    assertSame(pwd, info.getPassword());
}
Also used : AuthenticationInfo(org.apache.sling.auth.core.spi.AuthenticationInfo) Test(org.junit.Test)

Example 33 with AuthenticationInfo

use of org.apache.sling.auth.core.spi.AuthenticationInfo in project sling by apache.

the class AuthenticationInfoTest method testRemoveObject.

@Test
public void testRemoveObject() {
    final AuthenticationInfo info = new AuthenticationInfo("test");
    final Object value = "test";
    info.put("test", value);
    assertSame(value, info.get("test"));
    final Object removed = info.remove("test");
    assertSame(value, removed);
    assertFalse(info.containsKey("test"));
    assertNull(info.remove(AuthenticationInfo.AUTH_TYPE));
    Assert.assertEquals("test", info.get("sling.authType"));
    assertNull(info.remove("sling.authType"));
    Assert.assertEquals("test", info.getAuthType());
}
Also used : AuthenticationInfo(org.apache.sling.auth.core.spi.AuthenticationInfo) Test(org.junit.Test)

Example 34 with AuthenticationInfo

use of org.apache.sling.auth.core.spi.AuthenticationInfo in project sling by apache.

the class AuthenticationInfoTest method testFAIL_AUTH.

@Test
public void testFAIL_AUTH() {
    final AuthenticationInfo fa = AuthenticationInfo.FAIL_AUTH;
    Assert.assertEquals("FAIL_AUTH", fa.getAuthType());
    fa.clear();
    Assert.assertEquals("FAIL_AUTH", fa.getAuthType());
    fa.put("test", "test");
    assertFalse(fa.containsKey("test"));
}
Also used : AuthenticationInfo(org.apache.sling.auth.core.spi.AuthenticationInfo) Test(org.junit.Test)

Example 35 with AuthenticationInfo

use of org.apache.sling.auth.core.spi.AuthenticationInfo in project sling by apache.

the class AuthenticationInfoTest method testAuthenticationInfoString.

@Test
public void testAuthenticationInfoString() {
    final AuthenticationInfo info = new AuthenticationInfo("test");
    Assert.assertEquals("test", info.getAuthType());
    assertNull(info.getUser());
    assertNull(info.getPassword());
}
Also used : AuthenticationInfo(org.apache.sling.auth.core.spi.AuthenticationInfo) Test(org.junit.Test)

Aggregations

AuthenticationInfo (org.apache.sling.auth.core.spi.AuthenticationInfo)36 Test (org.junit.Test)25 HttpServletRequest (javax.servlet.http.HttpServletRequest)8 HttpServletResponse (javax.servlet.http.HttpServletResponse)8 SimpleCredentials (javax.jcr.SimpleCredentials)4 IOException (java.io.IOException)3 Collection (java.util.Collection)2 Credentials (javax.jcr.Credentials)2 LoginException (org.apache.sling.api.resource.LoginException)2 Method (java.lang.reflect.Method)1 AccountLockedException (javax.security.auth.login.AccountLockedException)1 AccountNotFoundException (javax.security.auth.login.AccountNotFoundException)1 CredentialExpiredException (javax.security.auth.login.CredentialExpiredException)1 Cookie (javax.servlet.http.Cookie)1 HttpSession (javax.servlet.http.HttpSession)1 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)1 FormCredentials (org.apache.sling.auth.form.impl.jaas.FormCredentials)1 XingUser (org.apache.sling.auth.xing.api.XingUser)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 Token (org.scribe.model.Token)1