/** * {@inheritDoc} */ @Override public void handleResponse(final HttpProxyResponse response) throws ProxyAuthException { // Should never get here ! throw new ProxyAuthException("Received error response code (" + response.getStatusLine() + ")."); } }
/** * Check if the given property(ies) is(are) set. Otherwise throws a * {@link ProxyAuthException}. */ public void checkRequiredProperties(String... propNames) throws ProxyAuthException { StringBuilder sb = new StringBuilder(); for (String propertyName : propNames) { if (properties.get(propertyName) == null) { sb.append(propertyName).append(' '); } } if (sb.length() > 0) { sb.append("property(ies) missing in request"); throw new ProxyAuthException(sb.toString()); } }
/** * {@inheritDoc} */ @Override public void handleResponse(final HttpProxyResponse response) throws ProxyAuthException { // Should never get here ! throw new ProxyAuthException("Received error response code (" + response.getStatusLine() + ")."); } }
/** * {@inheritDoc} */ @Override public void handleResponse(final HttpProxyResponse response) throws ProxyAuthException { // Should never get here ! throw new ProxyAuthException("Received error response code (" + response.getStatusLine() + ")."); } }
/** * Check if the given property(ies) is(are) set. Otherwise throws a * {@link ProxyAuthException}. * * @param propNames The list of property name to check * @throws ProxyAuthException If we get an error during the proxy authentication */ public void checkRequiredProperties(String... propNames) throws ProxyAuthException { StringBuilder sb = new StringBuilder(); for (String propertyName : propNames) { if (properties.get(propertyName) == null) { sb.append(propertyName).append(' '); } } if (sb.length() > 0) { sb.append("property(ies) missing in request"); throw new ProxyAuthException(sb.toString()); } }
/** * Check if the given property(ies) is(are) set. Otherwise throws a * {@link ProxyAuthException}. * * @param propNames The list of property name to check * @throws ProxyAuthException If we get an error during the proxy authentication */ public void checkRequiredProperties(String... propNames) throws ProxyAuthException { StringBuilder sb = new StringBuilder(); for (String propertyName : propNames) { if (properties.get(propertyName) == null) { sb.append(propertyName).append(' '); } } if (sb.length() > 0) { sb.append("property(ies) missing in request"); throw new ProxyAuthException(sb.toString()); } }
/** * {@inheritDoc} */ @Override public void handleResponse(final HttpProxyResponse response) throws ProxyAuthException { if (response.getStatusCode() != 407) { throw new ProxyAuthException("Received error response code (" + response.getStatusLine() + ")."); } } }
/** * {@inheritDoc} */ @Override public void handleResponse(final HttpProxyResponse response) throws ProxyAuthException { if (response.getStatusCode() != 407) { throw new ProxyAuthException("Received error response code (" + response.getStatusLine() + ")."); } } }
/** * {@inheritDoc} */ @Override public void handleResponse(final HttpProxyResponse response) throws ProxyAuthException { if (response.getStatusCode() != 407) { throw new ProxyAuthException("Received error response code (" + response.getStatusLine() + ")."); } } }
throw new ProxyAuthException("Unexpected error while reading server challenge !"); proxyIoSession.getCharsetName())); } catch (IOException e) { throw new ProxyAuthException("Unable to decode the base64 encoded NTLM challenge", e); throw new ProxyAuthException("Received unexpected response code (" + response.getStatusLine() + ").");
throw new ProxyAuthException("Received unexpected response code (" + response.getStatusLine() + ")."); throw new ProxyAuthException("Server doesn't support digest authentication method !"); proxyIoSession.getCharsetName())); } catch (Exception e) { throw new ProxyAuthException("Parsing of server digest directives failed", e); throw new ProxyAuthException("Received unexpected response code (" + response.getStatusLine() + ").");
/** * {@inheritDoc} */ @Override public void doHandshake(final NextFilter nextFilter) throws ProxyAuthException { logger.debug(" doHandshake()"); if (step > 0) { throw new ProxyAuthException("Authentication request already sent"); } // Send request HttpProxyRequest req = (HttpProxyRequest) request; Map<String, List<String>> headers = req.getHeaders() != null ? req.getHeaders() : new HashMap<String, List<String>>(); String username = req.getProperties().get(HttpProxyConstants.USER_PROPERTY); String password = req.getProperties().get(HttpProxyConstants.PWD_PROPERTY); StringUtilities.addValueToHeader(headers, "Proxy-Authorization", "Basic " + createAuthorization(username, password), true); addKeepAliveHeaders(headers); req.setHeaders(headers); writeRequest(nextFilter, req); step++; }
/** * {@inheritDoc} */ @Override public void doHandshake(final NextFilter nextFilter) throws ProxyAuthException { logger.debug(" doHandshake()"); if (step > 0) { throw new ProxyAuthException("Authentication request already sent"); } // Send request HttpProxyRequest req = (HttpProxyRequest) request; Map<String, List<String>> headers = req.getHeaders() != null ? req.getHeaders() : new HashMap<String, List<String>>(); String username = req.getProperties().get(HttpProxyConstants.USER_PROPERTY); String password = req.getProperties().get(HttpProxyConstants.PWD_PROPERTY); StringUtilities.addValueToHeader(headers, "Proxy-Authorization", "Basic " + createAuthorization(username, password), true); addKeepAliveHeaders(headers); req.setHeaders(headers); writeRequest(nextFilter, req); step++; }
/** * {@inheritDoc} */ @Override public void doHandshake(final NextFilter nextFilter) throws ProxyAuthException { logger.debug(" doHandshake()"); if (step > 0) { throw new ProxyAuthException("Authentication request already sent"); } // Send request HttpProxyRequest req = (HttpProxyRequest) request; Map<String, List<String>> headers = req.getHeaders() != null ? req .getHeaders() : new HashMap<>(); String username = req.getProperties().get( HttpProxyConstants.USER_PROPERTY); String password = req.getProperties().get( HttpProxyConstants.PWD_PROPERTY); StringUtilities.addValueToHeader(headers, "Proxy-Authorization", "Basic " + createAuthorization(username, password), true); addKeepAliveHeaders(headers); req.setHeaders(headers); writeRequest(nextFilter, req); step++; }
/** * Performs the handshake processing. * * @param nextFilter the next filter */ @Override public void doHandshake(final NextFilter nextFilter) throws ProxyAuthException { logger.debug(" doHandshake()"); if (authHandler != null) { authHandler.doHandshake(nextFilter); } else { if (requestSent) { // Safety check throw new ProxyAuthException("Authentication request already sent"); } logger.debug(" sending HTTP request"); // Compute request headers HttpProxyRequest req = (HttpProxyRequest) getProxyIoSession().getRequest(); Map<String, List<String>> headers = req.getHeaders() != null ? req.getHeaders() : new HashMap<String, List<String>>(); AbstractAuthLogicHandler.addKeepAliveHeaders(headers); req.setHeaders(headers); // Write request to the proxy writeRequest(nextFilter, req); requestSent = true; } }
/** * Performs the handshake processing. * * @param nextFilter the next filter */ @Override public void doHandshake(final NextFilter nextFilter) throws ProxyAuthException { logger.debug(" doHandshake()"); if (authHandler != null) { authHandler.doHandshake(nextFilter); } else { if (requestSent) { // Safety check throw new ProxyAuthException("Authentication request already sent"); } logger.debug(" sending HTTP request"); // Compute request headers HttpProxyRequest req = (HttpProxyRequest) getProxyIoSession().getRequest(); Map<String, List<String>> headers = req.getHeaders() != null ? req.getHeaders() : new HashMap<String, List<String>>(); AbstractAuthLogicHandler.addKeepAliveHeaders(headers); req.setHeaders(headers); // Write request to the proxy writeRequest(nextFilter, req); requestSent = true; } }
/** * Performs the handshake processing. * * @param nextFilter the next filter */ public void doHandshake(final NextFilter nextFilter) throws ProxyAuthException { logger.debug(" doHandshake()"); if (authHandler != null) { authHandler.doHandshake(nextFilter); } else { if (requestSent) { // Safety check throw new ProxyAuthException( "Authentication request already sent"); } logger.debug(" sending HTTP request"); // Compute request headers HttpProxyRequest req = (HttpProxyRequest) getProxyIoSession() .getRequest(); Map<String, List<String>> headers = req.getHeaders() != null ? req .getHeaders() : new HashMap<>(); AbstractAuthLogicHandler.addKeepAliveHeaders(headers); req.setHeaders(headers); // Write request to the proxy writeRequest(nextFilter, req); requestSent = true; } }
/** * Handle a HTTP response from the proxy server. * * @param response The proxy response. */ @Override public void handleResponse(final HttpProxyResponse response) throws ProxyAuthException { if (!isHandshakeComplete() && ("close".equalsIgnoreCase(StringUtilities.getSingleValuedHeader(response.getHeaders(), "Proxy-Connection")) || "close".equalsIgnoreCase(StringUtilities.getSingleValuedHeader( response.getHeaders(), "Connection")))) { getProxyIoSession().setReconnectionNeeded(true); } if (response.getStatusCode() == 407) { if (authHandler == null) { autoSelectAuthHandler(response); } authHandler.handleResponse(response); } else { throw new ProxyAuthException("Error: unexpected response code " + response.getStatusLine() + " received from proxy."); } } }
/** * Handle a HTTP response from the proxy server. * * @param response The proxy response. */ @Override public void handleResponse(final HttpProxyResponse response) throws ProxyAuthException { if (!isHandshakeComplete() && ("close".equalsIgnoreCase(StringUtilities.getSingleValuedHeader(response.getHeaders(), "Proxy-Connection")) || "close".equalsIgnoreCase(StringUtilities.getSingleValuedHeader( response.getHeaders(), "Connection")))) { getProxyIoSession().setReconnectionNeeded(true); } if (response.getStatusCode() == 407) { if (authHandler == null) { autoSelectAuthHandler(response); } authHandler.handleResponse(response); } else { throw new ProxyAuthException("Error: unexpected response code " + response.getStatusLine() + " received from proxy."); } } }
/** * Handle a HTTP response from the proxy server. * * @param response The proxy response. */ @Override public void handleResponse(final HttpProxyResponse response) throws ProxyAuthException { if (!isHandshakeComplete() && ("close".equalsIgnoreCase(StringUtilities .getSingleValuedHeader(response.getHeaders(), "Proxy-Connection")) || "close" .equalsIgnoreCase(StringUtilities .getSingleValuedHeader(response.getHeaders(), "Connection")))) { getProxyIoSession().setReconnectionNeeded(true); } if (response.getStatusCode() == 407) { if (authHandler == null) { autoSelectAuthHandler(response); } authHandler.handleResponse(response); } else { throw new ProxyAuthException("Error: unexpected response code " + response.getStatusLine() + " received from proxy."); } } }