Example usage for org.apache.http.impl.auth BasicScheme BasicScheme

List of usage examples for org.apache.http.impl.auth BasicScheme BasicScheme

Introduction

In this page you can find the example usage for org.apache.http.impl.auth BasicScheme BasicScheme.

Prototype

@Deprecated
public BasicScheme(final ChallengeState challengeState) 

Source Link

Document

Creates an instance of BasicScheme with the given challenge state.

Usage

From source file:org.apache.http.impl.auth.TestBasicScheme.java

@Test
public void testBasicAuthenticationWith88591Chars() throws Exception {
    final int[] germanChars = { 0xE4, 0x2D, 0xF6, 0x2D, 0xFc };
    final StringBuilder buffer = new StringBuilder();
    for (final int germanChar : germanChars) {
        buffer.append((char) germanChar);
    }/*from   w  w  w  . j  a  v  a2 s  .  com*/

    final UsernamePasswordCredentials creds = new UsernamePasswordCredentials("dh", buffer.toString());
    final BasicScheme authscheme = new BasicScheme(Consts.ISO_8859_1);

    final HttpRequest request = new BasicHttpRequest("GET", "/");
    final HttpContext context = new BasicHttpContext();
    final Header header = authscheme.authenticate(creds, request, context);
    Assert.assertEquals("Basic ZGg65C32Lfw=", header.getValue());
}