Package edu.indiana.lib.twinpeaks.net
Class HttpAuthenticator
- java.lang.Object
-
- java.net.Authenticator
-
- edu.indiana.lib.twinpeaks.net.HttpAuthenticator
-
public class HttpAuthenticator extends Authenticator
Handle network authentication.When we try to access a protected site,
getPasswordAuthentication()is called by the network connection code (HttpURLConnectionin our case) to obtain any credentials (username and password) required to access the site.Note: This only occurs until we successfully "log in" - after that, we are not invoked again for the site in question.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.net.Authenticator
Authenticator.RequestorType
-
-
Constructor Summary
Constructors Constructor Description HttpAuthenticator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PasswordAuthenticationgetPasswordAuthentication()Override the default implementation to provide the credentials required for our network authenticationvoidsetCredentials(String realm, String username, String password)Establish realm login credentials-
Methods inherited from class java.net.Authenticator
getDefault, getRequestingHost, getRequestingPort, getRequestingPrompt, getRequestingProtocol, getRequestingScheme, getRequestingSite, getRequestingURL, getRequestorType, requestPasswordAuthentication, requestPasswordAuthentication, requestPasswordAuthentication, requestPasswordAuthentication, requestPasswordAuthenticationInstance, setDefault
-
-
-
-
Method Detail
-
setCredentials
public void setCredentials(String realm, String username, String password)
Establish realm login credentials- Parameters:
realm- Realm for authentication (ADS)username- User for loginpassword- Password
-
getPasswordAuthentication
protected PasswordAuthentication getPasswordAuthentication()
Override the default implementation to provide the credentials required for our network authentication- Overrides:
getPasswordAuthenticationin classAuthenticator
-
-