Class AuthChallengeParser


  • public final class AuthChallengeParser
    extends Object
    This class provides utility methods for parsing HTTP www and proxy authentication challenges.
    Since:
    2.0beta1
    Author:
    Oleg Kalnichevski
    • Constructor Detail

      • AuthChallengeParser

        public AuthChallengeParser()
    • Method Detail

      • extractScheme

        public static String extractScheme​(String challengeStr)
                                    throws MalformedChallengeException
        Extracts authentication scheme from the given authentication challenge.
        Parameters:
        challengeStr - the authentication challenge string
        Returns:
        authentication scheme
        Throws:
        MalformedChallengeException - when the authentication challenge string is malformed
        Since:
        2.0beta1
      • extractParams

        public static Map extractParams​(String challengeStr)
                                 throws MalformedChallengeException
        Extracts a map of challenge parameters from an authentication challenge. Keys in the map are lower-cased
        Parameters:
        challengeStr - the authentication challenge string
        Returns:
        a map of authentication challenge parameters
        Throws:
        MalformedChallengeException - when the authentication challenge string is malformed
        Since:
        2.0beta1
      • parseChallenges

        public static Map parseChallenges​(Header[] headers)
                                   throws MalformedChallengeException
        Extracts a map of challenges ordered by authentication scheme name
        Parameters:
        headers - the array of authorization challenges
        Returns:
        a map of authorization challenges
        Throws:
        MalformedChallengeException - if any of challenge strings is malformed
        Since:
        3.0