You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Renat Sabitov (JIRA)" <ji...@apache.org> on 2015/05/28 06:06:17 UTC

[jira] [Created] (HTTPCLIENT-1652) AuthSchemeBase.challengeState doesn't survive serialisation in BasicAuthCache

Renat Sabitov created HTTPCLIENT-1652:
-----------------------------------------

             Summary: AuthSchemeBase.challengeState doesn't survive serialisation in BasicAuthCache
                 Key: HTTPCLIENT-1652
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1652
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpAuth
    Affects Versions: 4.4.1
            Reporter: Renat Sabitov


If a BasicScheme with ChallengeState defined is put in a BasicAuthCache, it comes out of the cache with null challengeState.

This is a small test to demonstrate the problem:

{code}
    @Test
    public void assertChallengeStateSurvivesSerialisation() throws Exception {
        BasicAuthCache localCache = new BasicAuthCache();
        HttpHost aHost = new HttpHost("sample.host", 80);

        BasicScheme proxyScheme = new BasicScheme();
        proxyScheme.processChallenge(
                new BasicHeader(HttpHeaders.PROXY_AUTHENTICATE, "Basic "));

        assertThat(proxyScheme.getChallengeState(), is(ChallengeState.PROXY));

        localCache.put(aHost, proxyScheme);

        BasicScheme outOfCache = (BasicScheme) localCache.get(aHost);
        assertThat(outOfCache.getChallengeState(), is(ChallengeState.PROXY));
    }
{code}

result is:
{noformat}
java.lang.AssertionError: 
Expected: is <PROXY>
     but: was null
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org