@Test public void getChallengesFromMultipleWWWAuthHeader() { final String expectedChallenge1 = "Newauth realm=\"apps\", type=1, title=\"Login to \\\"apps\\\"\""; final String expectedChallenge2 = "Basic realm=\"simple\""; List<WWWAuthChallenge> result = getChallenges(MULTIPLE_TYPE_WWW_AUTH_HEADER_WITH_PARAMS); WWWAuthChallenge challenge = result.get(0); Assert.assertEquals("Newauth", challenge.getScheme()); Assert.assertEquals("apps", challenge.getRealm()); Assert.assertEquals(expectedChallenge1, challenge.getChallenge()); challenge = result.get(1); Assert.assertEquals("Basic", challenge.getScheme()); Assert.assertEquals("simple", challenge.getRealm()); Assert.assertEquals(expectedChallenge2, challenge.getChallenge()); }
public static List<WWWAuthChallenge> getChallenges(String headerValue) { List<WWWAuthChallenge> challenges = new ArrayList<>(); for (String challenge : splitWWWAuthenticateHeaderBySchemes(headerValue)) { challenges.add(new WWWAuthChallenge(challenge)); } return challenges; }
WWWAuthenticateHeaderUtils { public static List<WWWAuthChallenge> getChallenges(String headerValue) { List<WWWAuthChallenge> challenges = new ArrayList<>(); for (String challenge : splitWWWAuthenticateHeaderBySchemes(headerValue)) { challenges.add(new WWWAuthChallenge(challenge)); } return challenges; } }
WWWAuthenticateHeaderUtils { public static List<WWWAuthChallenge> getChallenges(String headerValue) { List<WWWAuthChallenge> challenges = new ArrayList<>(); for (String challenge : splitWWWAuthenticateHeaderBySchemes(headerValue)) { challenges.add(new WWWAuthChallenge(challenge)); } return challenges; } private  WWWAuthenticateHeaderUtils(); }
WWWAuthenticateHeaderUtils { public static List<WWWAuthChallenge> getChallenges(String headerValue) { List<WWWAuthChallenge> challenges = new ArrayList<>(); for (String challenge : splitWWWAuthenticateHeaderBySchemes(headerValue)) { challenges.add(new WWWAuthChallenge(challenge)); } return challenges; } private  WWWAuthenticateHeaderUtils(); static List<WWWAuthChallenge> getChallenges(String headerValue); }
WWWAuthenticateHeaderUtils { public static List<WWWAuthChallenge> getChallenges(String headerValue) { List<WWWAuthChallenge> challenges = new ArrayList<>(); for (String challenge : splitWWWAuthenticateHeaderBySchemes(headerValue)) { challenges.add(new WWWAuthChallenge(challenge)); } return challenges; } private  WWWAuthenticateHeaderUtils(); static List<WWWAuthChallenge> getChallenges(String headerValue);  }