@Test public void getChallengeFromMultipleWWWAuthHeader() { String[] result = splitWWWAuthenticateHeaderBySchemes(MULTIPLE_TYPE_WWW_AUTH_HEADER_WITH_PARAMS); Assert.assertEquals(2, result.length); final String expectedChallenge1 = "Newauth realm=\"apps\", type=1, title=\"Login to \\\"apps\\\"\""; final String expectedChallenge2 = "Basic realm=\"simple\""; Assert.assertEquals(expectedChallenge1, result[0]); Assert.assertEquals(expectedChallenge2, result[1]); WWWAuthChallenge challenge = new WWWAuthChallenge(result[0]); Assert.assertEquals("Newauth", challenge.getScheme()); Assert.assertEquals("apps", challenge.getRealm()); Assert.assertEquals(expectedChallenge1, challenge.getChallenge()); challenge = new WWWAuthChallenge(result[1]); Assert.assertEquals("Basic", challenge.getScheme()); Assert.assertEquals("simple", challenge.getRealm()); Assert.assertEquals(expectedChallenge2, challenge.getChallenge()); }
static String[] splitWWWAuthenticateHeaderBySchemes(String headerValue) { return headerValue.split(",\\s(?=[^\\s]+\\srealm=)"); }
WWWAuthenticateHeaderUtils { static String[] splitWWWAuthenticateHeaderBySchemes(String headerValue) { return headerValue.split(",\\s(?=[^\\s]+\\srealm=)"); } }
WWWAuthenticateHeaderUtils { static String[] splitWWWAuthenticateHeaderBySchemes(String headerValue) { return headerValue.split(",\\s(?=[^\\s]+\\srealm=)"); } private  WWWAuthenticateHeaderUtils(); }
WWWAuthenticateHeaderUtils { static String[] splitWWWAuthenticateHeaderBySchemes(String headerValue) { return headerValue.split(",\\s(?=[^\\s]+\\srealm=)"); } private  WWWAuthenticateHeaderUtils(); static List<WWWAuthChallenge> getChallenges(String headerValue); }
WWWAuthenticateHeaderUtils { static String[] splitWWWAuthenticateHeaderBySchemes(String headerValue) { return headerValue.split(",\\s(?=[^\\s]+\\srealm=)"); } private  WWWAuthenticateHeaderUtils(); static List<WWWAuthChallenge> getChallenges(String headerValue);  }