net.lightbody.bmp.proxy.auth.AuthType Java Examples

The following examples show how to use net.lightbody.bmp.proxy.auth.AuthType. 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: BrowserMobProxyServer.java    From CapturePacket with MIT License 5 votes vote down vote up
@Override
public void autoAuthorization(String domain, String username, String password, AuthType authType) {
    switch (authType) {
        case BASIC:
            // base64 encode the "username:password" string
            String base64EncodedCredentials = BrowserMobHttpUtil.base64EncodeBasicCredentials(username, password);

            basicAuthCredentials.put(domain, base64EncodedCredentials);
            break;

        default:
            throw new UnsupportedOperationException("AuthType " + authType + " is not supported for HTTP Authorization");
    }
}
 
Example #2
Source File: BrowserMobProxyServer.java    From CapturePacket with MIT License 5 votes vote down vote up
@Override
public void chainedProxyAuthorization(String username, String password, AuthType authType) {
    switch (authType) {
        case BASIC:
            chainedProxyCredentials = BrowserMobHttpUtil.base64EncodeBasicCredentials(username, password);
            break;

        default:
            throw new UnsupportedOperationException("AuthType " + authType + " is not supported for Proxy Authorization");
    }
}
 
Example #3
Source File: BrowserMobProxyServer.java    From Dream-Catcher with MIT License 5 votes vote down vote up
@Override
public void autoAuthorization(String domain, String username, String password, AuthType authType) {
    switch (authType) {
        case BASIC:
            // base64 encode the "username:password" string
            String base64EncodedCredentials = BrowserMobHttpUtil.base64EncodeBasicCredentials(username, password);

            basicAuthCredentials.put(domain, base64EncodedCredentials);
            break;

        default:
            throw new UnsupportedOperationException("AuthType " + authType + " is not supported for HTTP Authorization");
    }
}
 
Example #4
Source File: BrowserMobProxyServer.java    From Dream-Catcher with MIT License 5 votes vote down vote up
@Override
public void chainedProxyAuthorization(String username, String password, AuthType authType) {
    switch (authType) {
        case BASIC:
            chainedProxyCredentials = BrowserMobHttpUtil.base64EncodeBasicCredentials(username, password);
            break;

        default:
            throw new UnsupportedOperationException("AuthType " + authType + " is not supported for Proxy Authorization");
    }
}
 
Example #5
Source File: BrowserMobProxyServer.java    From AndroidHttpCapture with MIT License 5 votes vote down vote up
@Override
public void autoAuthorization(String domain, String username, String password, AuthType authType) {
    switch (authType) {
        case BASIC:
            // base64 encode the "username:password" string
            String base64EncodedCredentials = BrowserMobHttpUtil.base64EncodeBasicCredentials(username, password);

            basicAuthCredentials.put(domain, base64EncodedCredentials);
            break;

        default:
            throw new UnsupportedOperationException("AuthType " + authType + " is not supported for HTTP Authorization");
    }
}
 
Example #6
Source File: BrowserMobProxyServer.java    From AndroidHttpCapture with MIT License 5 votes vote down vote up
@Override
public void chainedProxyAuthorization(String username, String password, AuthType authType) {
    switch (authType) {
        case BASIC:
            chainedProxyCredentials = BrowserMobHttpUtil.base64EncodeBasicCredentials(username, password);
            break;

        default:
            throw new UnsupportedOperationException("AuthType " + authType + " is not supported for Proxy Authorization");
    }
}
 
Example #7
Source File: BrowsermobProxyUtilsImpl.java    From IridiumApplicationTesting with MIT License 4 votes vote down vote up
/**
 * Starts the Browsermob Proxy
 *
 * @return The port that the proxy is listening on
 */
private ProxyDetails<BrowserMobProxy> startBrowsermobProxy(
		@NotNull final Optional<ProxySettings> upstreamProxy) throws Exception {

	final BrowserMobProxy browserMobProxy = new BrowserMobProxyServer();
	browserMobProxy.setTrustAllServers(true);

	/*
		Prevent errors like this:

		09:58:29.348 [LittleProxy-0-ProxyToServerWorker-2] ERROR o.l.p.impl.ProxyToServerConnection -
		(AWAITING_INITIAL) [id: 0x95af9921, L:/127.0.0.1:60359 - R:/127.0.0.1:3128]:
		Caught an exception on ProxyToServerConnection io.netty.handler.codec.TooLongFrameException:
		HTTP content length exceeded 2097152 bytes.
	 */
	browserMobProxy.addFirstHttpFilterFactory(new HttpFiltersSourceAdapter() {
		@Override
		public int getMaximumRequestBufferSizeInBytes() {
			return Integer.MAX_VALUE;
		}

		@Override
		public int getMaximumResponseBufferSizeInBytes() {
			return Integer.MAX_VALUE;
		}
	});

	if (upstreamProxy.isPresent()) {
		browserMobProxy.setChainedProxy(new InetSocketAddress(
			upstreamProxy.get().getHost(),
			upstreamProxy.get().getPort()));

		if (StringUtils.isNotBlank(upstreamProxy.get().getUsername())) {
			browserMobProxy.chainedProxyAuthorization(
				upstreamProxy.get().getUsername(),
				upstreamProxy.get().getPassword(),
				AuthType.BASIC);
		}
	}

	browserMobProxy.start(0);

	final ProxyDetails<BrowserMobProxy> proxyDetails =
		new ProxyDetailsImpl<>(browserMobProxy.getPort(), true, PROXY_NAME, browserMobProxy);

	trackErrorResponses(browserMobProxy, proxyDetails);

	return proxyDetails;
}
 
Example #8
Source File: BrowserMobProxy.java    From CapturePacket with MIT License 2 votes vote down vote up
/**
 * Enables automatic authorization for the specified domain and auth type. Every request sent to the specified domain will contain the
 * specified authorization information.
 *
 * @param domain domain automatically send authorization information to
 * @param username authorization username
 * @param password authorization password
 * @param authType authorization type
 */
void autoAuthorization(String domain, String username, String password, AuthType authType);
 
Example #9
Source File: BrowserMobProxy.java    From CapturePacket with MIT License 2 votes vote down vote up
/**
 * Enables chained proxy authorization using the Proxy-Authorization header described in RFC 7235, section 4.4 (https://tools.ietf.org/html/rfc7235#section-4.4).
 * Currently, only {@link AuthType#BASIC} authentication is supported.
 *
 * @param username the username to use to authenticate with the chained proxy
 * @param password the password to use to authenticate with the chained proxy
 * @param authType the auth type to use (currently, must be BASIC)
 */
void chainedProxyAuthorization(String username, String password, AuthType authType);
 
Example #10
Source File: BrowserMobProxy.java    From Dream-Catcher with MIT License 2 votes vote down vote up
/**
 * Enables automatic authorization for the specified domain and auth type. Every request sent to the specified domain will contain the
 * specified authorization information.
 *
 * @param domain domain automatically send authorization information to
 * @param username authorization username
 * @param password authorization password
 * @param authType authorization type
 */
void autoAuthorization(String domain, String username, String password, AuthType authType);
 
Example #11
Source File: BrowserMobProxy.java    From Dream-Catcher with MIT License 2 votes vote down vote up
/**
 * Enables chained proxy authorization using the Proxy-Authorization header described in RFC 7235, section 4.4 (https://tools.ietf.org/html/rfc7235#section-4.4).
 * Currently, only {@link AuthType#BASIC} authentication is supported.
 *
 * @param username the username to use to authenticate with the chained proxy
 * @param password the password to use to authenticate with the chained proxy
 * @param authType the auth type to use (currently, must be BASIC)
 */
void chainedProxyAuthorization(String username, String password, AuthType authType);
 
Example #12
Source File: BrowserMobProxy.java    From AndroidHttpCapture with MIT License 2 votes vote down vote up
/**
 * Enables automatic authorization for the specified domain and auth type. Every request sent to the specified domain will contain the
 * specified authorization information.
 *
 * @param domain domain automatically send authorization information to
 * @param username authorization username
 * @param password authorization password
 * @param authType authorization type
 */
void autoAuthorization(String domain, String username, String password, AuthType authType);
 
Example #13
Source File: BrowserMobProxy.java    From AndroidHttpCapture with MIT License 2 votes vote down vote up
/**
 * Enables chained proxy authorization using the Proxy-Authorization header described in RFC 7235, section 4.4 (https://tools.ietf.org/html/rfc7235#section-4.4).
 * Currently, only {@link AuthType#BASIC} authentication is supported.
 *
 * @param username the username to use to authenticate with the chained proxy
 * @param password the password to use to authenticate with the chained proxy
 * @param authType the auth type to use (currently, must be BASIC)
 */
void chainedProxyAuthorization(String username, String password, AuthType authType);