private static Map < String , String > extractChallenge ( String authenticateHeader , String authChallengePrefix ) { if ( ! isValidChallenge ( authenticateHeader , authChallengePrefix ) ) { return null ; } authenticateHeader = authenticateHeader . toLowerCase ( ) . replace ( authChallengePrefix . toLowerCase ( ) , "" ) ; String [ ] challenges = authenticateHeader . split ( ", " ) ; Map < String , String > challengeMap = new HashMap < String , String > ( ) ; for ( String pair : challenges ) { String [ ] keyValue = pair . split ( "=" ) ; challengeMap . put ( keyValue [ 0 ] . replaceAll ( "\"" , "" ) , keyValue [ 1 ] . replaceAll ( "\"" , "" ) ) ; } return challengeMap ; }
Extracts the challenge off the authentication header .