Last active
August 29, 2015 13:56
-
-
Save uhbif19/9063043 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def authenticate(user: String, password: String) = { | |
/* Установить логин и пароль по умолчанию, необходимые для доступа к прокси. | |
Идея отсюда: http://blog.vinodsingh.com/2008/05/proxy-authentication-in-java.html*/ | |
import java.net.{Authenticator, PasswordAuthentication} | |
class ProxyAuthenticator(var user: String, var password: String) | |
extends Authenticator { | |
protected override def getPasswordAuthentication(): PasswordAuthentication = { | |
return new PasswordAuthentication(user, password.toCharArray()); | |
} | |
} | |
Authenticator.setDefault(new ProxyAuthenticator(user, password)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment