Package org.faceless.pdf2.viewer2.util
Class PromptingAuthenticator
- java.lang.Object
-
- java.net.Authenticator
-
- org.faceless.pdf2.viewer2.util.PromptingAuthenticator
-
public class PromptingAuthenticator extends Authenticator
A simpleAuthenticator
which will prompt the user to enter the required name and password with a Swing dialog. Names and passwords are cached by default, but this behaviour can be disabled by callingsetCaching(boolean)
. To use, simply callAuthenticator.setDefault(new PromptingAuthenticator(component))
- Since:
- 2.14.1
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.net.Authenticator
Authenticator.RequestorType
-
-
Constructor Summary
Constructors Constructor Description PromptingAuthenticator()
Create a new PromptingAuthenticator with no root component specifiedPromptingAuthenticator(Component root)
Create a new PromptingAuthenticator and specify the Component the dialog should be opened above
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PasswordAuthentication
getPasswordAuthentication()
void
setCaching(boolean cache)
Set whether to cache names/passwords - if true (the default), the dialog will be presented with the previous values already specified.void
setHandleNegotiate(boolean negotiate)
If true, this Authenticator will prompt for the "Negotiate" method of authentication.void
setRoot(Component root)
Set the root Component the dialog should be opened above-
Methods inherited from class java.net.Authenticator
getDefault, getRequestingHost, getRequestingPort, getRequestingPrompt, getRequestingProtocol, getRequestingScheme, getRequestingSite, getRequestingURL, getRequestorType, requestPasswordAuthentication, requestPasswordAuthentication, requestPasswordAuthentication, requestPasswordAuthentication, requestPasswordAuthenticationInstance, setDefault
-
-
-
-
Constructor Detail
-
PromptingAuthenticator
public PromptingAuthenticator()
Create a new PromptingAuthenticator with no root component specified
-
PromptingAuthenticator
public PromptingAuthenticator(Component root)
Create a new PromptingAuthenticator and specify the Component the dialog should be opened above- Parameters:
root
- the root component for the dialog
-
-
Method Detail
-
setHandleNegotiate
public void setHandleNegotiate(boolean negotiate)
If true, this Authenticator will prompt for the "Negotiate" method of authentication. This has been causing problems on some customer sites, so we have added the option to bypass it.- Since:
- 2.20.2
-
setRoot
public void setRoot(Component root)
Set the root Component the dialog should be opened above- Parameters:
root
- the root component for the dialog
-
setCaching
public void setCaching(boolean cache)
Set whether to cache names/passwords - if true (the default), the dialog will be presented with the previous values already specified.- Parameters:
cache
- whether to cache names/password
-
getPasswordAuthentication
protected PasswordAuthentication getPasswordAuthentication()
- Overrides:
getPasswordAuthentication
in classAuthenticator
-
-