summaryrefslogblamecommitdiffstats
path: root/src/main/java/org/openslx/network/StaticProxyAuthenticator.java
blob: c1d8da77f9a62e0b67b7a0cdc84c27eae7294761 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                           

                                                                 



                                                                             
package org.openslx.network;

import java.net.Authenticator;
import java.net.PasswordAuthentication;

public class StaticProxyAuthenticator extends Authenticator
{
	private final String username, password;

	public StaticProxyAuthenticator( String username, String password )
	{
		this.username = username;
		this.password = password;
	}

	protected PasswordAuthentication getPasswordAuthentication()
	{
		if ( getRequestorType() != RequestorType.PROXY )
			return super.getPasswordAuthentication();
		return new PasswordAuthentication(
				this.username, this.password.toCharArray() );
	}
}