Search in sources :

Example 1 with HttpAuthorizationHandler

use of de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler in project Kustvakt by KorAP.

the class StringUtilsTest method testBasicHttpSplit.

@Test
public void testBasicHttpSplit() throws KustvaktException {
    String s2 = new String(Base64.encodeBase64("test:testPass".getBytes()));
    String[] f2 = TransferEncoding.decodeBase64(s2);
    assertEquals("test", f2[0]);
    assertEquals("testPass", f2[1]);
    HttpAuthorizationHandler handler = new HttpAuthorizationHandler();
    String s1 = "basic " + new String(Base64.encodeBase64("test:testPass".getBytes()));
    AuthorizationData f1 = handler.parseAuthorizationHeaderValue(s1);
    assertEquals(s2, f1.getToken());
}
Also used : AuthorizationData(de.ids_mannheim.korap.authentication.http.AuthorizationData) HttpAuthorizationHandler(de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler) Test(org.junit.Test)

Aggregations

AuthorizationData (de.ids_mannheim.korap.authentication.http.AuthorizationData)1 HttpAuthorizationHandler (de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler)1 Test (org.junit.Test)1