org.apache.http.auth.MalformedChallengeException Java Examples
The following examples show how to use
org.apache.http.auth.MalformedChallengeException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GGSSchemeBase.java From ats-framework with Apache License 2.0 | 6 votes |
@Override protected void parseChallenge( final CharArrayBuffer buffer, int beginIndex, int endIndex ) throws MalformedChallengeException { String challenge = buffer.substringTrimmed(beginIndex, endIndex); if (log.isDebugEnabled()) { log.debug("Received challenge '" + challenge + "' from the auth server"); } if (state == State.UNINITIATED) { token = base64codec.decode(challenge.getBytes()); state = State.CHALLENGE_RECEIVED; } else { log.debug("Authentication already attempted"); state = State.FAILED; } }
Example #2
Source File: RequestHeaderAuthenticationStrategy.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@Override public Map<String, Header> getChallenges( final HttpHost authhost, final HttpResponse response, final HttpContext context) throws MalformedChallengeException { HttpRequest request = (HttpRequest) context.getAttribute(REQUEST_ATTRIBUTE); if (request != null) { Optional<Header> bearerTokenRequestOpt = getBearerHeader(request, HttpHeaders.AUTHORIZATION); Optional<Header> bearerTokenResponseOpt = getBearerHeader(response, HttpHeaders.WWW_AUTHENTICATE); /* Add necessary bearer token from request to response if it's absent, it's required for avoid infinite loop in docker (see NEXUS-23360) */ if (bearerTokenRequestOpt.isPresent() && !bearerTokenResponseOpt.isPresent()) { response.addHeader(HttpHeaders.WWW_AUTHENTICATE, bearerTokenRequestOpt.get().getValue()); } } return super.getChallenges(authhost, response, context); }
Example #3
Source File: LibRequestDirector.java From YiBo with Apache License 2.0 | 6 votes |
private void processChallenges( final Map<String, Header> challenges, final AuthState authState, final AuthenticationHandler authHandler, final HttpResponse response, final HttpContext context) throws MalformedChallengeException, AuthenticationException { AuthScheme authScheme = authState.getAuthScheme(); if (authScheme == null) { // Authentication not attempted before authScheme = authHandler.selectScheme(challenges, response, context); authState.setAuthScheme(authScheme); } String id = authScheme.getSchemeName(); Header challenge = challenges.get(id.toLowerCase(Locale.ENGLISH)); if (challenge == null) { throw new AuthenticationException(id + " authorization challenge expected, but not found"); } authScheme.processChallenge(challenge); if (DEBUG) { Logger.debug("Authorization challenge processed"); } }
Example #4
Source File: Http4SignatureAuthScheme.java From httpsig-java with The Unlicense | 4 votes |
@Override protected void parseChallenge(CharArrayBuffer buffer, int pos, int len) throws MalformedChallengeException { super.parseChallenge(buffer, pos, len); this.rotate = true; }