@Override public void processChallenge( final AuthChallenge authChallenge, final HttpContext context) throws MalformedChallengeException { Args.notNull(authChallenge, "AuthChallenge"); if (authChallenge.getValue() == null) { throw new MalformedChallengeException("Missing auth challenge"); } challengeType = authChallenge.getChallengeType(); challenge = authChallenge.getValue(); if (challenge.isEmpty()) { if (clientCred != null) { dispose(); // run cleanup first before throwing an exception otherwise can leak OS resources if (continueNeeded) { throw new IllegalStateException("Unexpected token"); } } } }
@Override public void processChallenge( final AuthChallenge authChallenge, final HttpContext context) throws MalformedChallengeException { Args.notNull(authChallenge, "AuthChallenge"); if (authChallenge.getValue() == null) { throw new MalformedChallengeException("Missing auth challenge"); } this.challenge = authChallenge.getValue(); if (state == State.UNINITIATED) { token = Base64.decodeBase64(challenge.getBytes()); state = State.CHALLENGE_RECEIVED; } else { log.debug("Authentication already attempted"); state = State.FAILED; } }
@Override public void processChallenge( final AuthChallenge authChallenge, final HttpContext context) throws MalformedChallengeException { this.paramMap.clear(); final List<NameValuePair> params = authChallenge.getParams(); if (params != null) { for (final NameValuePair param: params) { this.paramMap.put(param.getName().toLowerCase(Locale.ROOT), param.getValue()); } } this.complete = true; }
private static AuthChallenge createAuthChallenge(final ChallengeType challengeType, final String scheme, final List<NameValuePair> params) throws ParseException { if (scheme != null) { if (params.size() == 1) { final NameValuePair nvp = params.get(0); if (nvp.getValue() == null) { return new AuthChallenge(challengeType, scheme, nvp.getName(), null); } } return new AuthChallenge(challengeType, scheme, null, params.size() > 0 ? params : null); } if (params.size() == 1) { final NameValuePair nvp = params.get(0); if (nvp.getValue() == null) { return new AuthChallenge(challengeType, nvp.getName(), null, null); } } throw new ParseException("Malformed auth challenge"); }
final String scheme = authChallenge.getScheme().toLowerCase(Locale.ROOT); if (!challengeMap.containsKey(scheme)) { challengeMap.put(scheme, authChallenge);
@Override public void processChallenge( final AuthChallenge authChallenge, final HttpContext context) throws MalformedChallengeException { Args.notNull(authChallenge, "AuthChallenge"); if (authChallenge.getValue() == null) { throw new MalformedChallengeException("Missing auth challenge"); } this.challenge = authChallenge.getValue(); if (this.challenge == null || this.challenge.isEmpty()) { if (this.state == State.UNINITIATED) { this.state = State.CHALLENGE_RECEIVED; } else { this.state = State.FAILED; } } else { if (this.state.compareTo(State.MSG_TYPE1_GENERATED) < 0) { this.state = State.FAILED; throw new MalformedChallengeException("Out of sequence NTLM response message"); } else if (this.state == State.MSG_TYPE1_GENERATED) { this.state = State.MSG_TYPE2_RECEVIED; } } }
@Override public void processChallenge( final AuthChallenge authChallenge, final HttpContext context) throws MalformedChallengeException { Args.notNull(authChallenge, "AuthChallenge"); this.paramMap.clear(); final List<NameValuePair> params = authChallenge.getParams(); if (params != null) { for (final NameValuePair param: params) { this.paramMap.put(param.getName().toLowerCase(Locale.ROOT), param.getValue()); } } if (this.paramMap.isEmpty()) { throw new MalformedChallengeException("Missing digest auth parameters"); } this.complete = true; }
@Override public void processChallenge( final AuthChallenge authChallenge, final HttpContext context) throws MalformedChallengeException { Args.notNull(authChallenge, "AuthChallenge"); if (authChallenge.getValue() == null) { throw new MalformedChallengeException("Missing auth challenge"); } challengeType = authChallenge.getChallengeType(); challenge = authChallenge.getValue(); if (challenge.isEmpty()) { if (clientCred != null) { dispose(); // run cleanup first before throwing an exception otherwise can leak OS resources if (continueNeeded) { throw new IllegalStateException("Unexpected token"); } } } }