RFC2617Scheme extends AuthSchemeBase { public String getParameter(final String name) { if (name == null) { throw new IllegalArgumentException("Parameter name may not be null"); } if (this.params == null) { return null; } return this.params.get(name.toLowerCase(Locale.ENGLISH)); } RFC2617Scheme(); String getParameter(final String name); String getRealm();  }
@Test public void testProcessChallenge() throws Exception { TestAuthScheme authscheme = new TestAuthScheme(); Header header = new BasicHeader( AUTH.WWW_AUTH, "Test realm=\"realm1\", test, test1 = stuff, test2 = \"stuff, stuff\", test3=\"crap"); authscheme.processChallenge(header); Assert.assertEquals("test", authscheme.getSchemeName()); Assert.assertEquals("realm1", authscheme.getParameter("realm")); Assert.assertEquals(null, authscheme.getParameter("test")); Assert.assertEquals("stuff", authscheme.getParameter("test1")); Assert.assertEquals("stuff, stuff", authscheme.getParameter("test2")); Assert.assertEquals("\"crap", authscheme.getParameter("test3")); }
@Test public void testProcessChallengeWithLotsOfBlanks() throws Exception { TestAuthScheme authscheme = new TestAuthScheme(); CharArrayBuffer buffer = new CharArrayBuffer(32); buffer.append(" WWW-Authenticate: Test realm=\"realm1\""); Header header = new BufferedHeader(buffer); authscheme.processChallenge(header); Assert.assertEquals("test", authscheme.getSchemeName()); Assert.assertEquals("realm1", authscheme.getParameter("realm")); }