Class TLcyNetworkConnectionAddOn
java.lang.Object
com.luciad.lucy.addons.ALcyAddOn
com.luciad.lucy.addons.ALcyPreferencesAddOn
com.luciad.lucy.addons.networkconnection.TLcyNetworkConnectionAddOn
This addon allows to configure settings related to network connections used in Lucy.
By default, the following settings are provided:
- Proxy configuration
- A menu item "Proxy settings..." is added to the menu "Edit", allowing to configure proxy hostname and password, proxy exceptions and proxy authentication.
- The proxy settings are enabled JVM-wide through a static
ProxySelector
andAuthenticator
. - The proxy settings are made persistent through the user preferences, using
com.luciad.lucy.util.TLcyProperties
. The keys are prefixed by the addon class name. - Server authentication
-
A JVM-wide static
Authenticator
is used to request user credentials (username and password) in a dialog, when a server is accessed that requires BASIC or DIGEST authentication. Providing hard-coded credentials for certain servers can be done by overridinggetPasswordAuthentication(String, int, String, String, String, InetAddress, URL, Authenticator.RequestorType)
.
- Since:
- 10.1
-
Constructor Summary
ConstructorDescriptionCreates the addon using the default preferences. -
Method Summary
Modifier and TypeMethodDescriptionprotected PasswordAuthentication
getPasswordAuthentication
(String aRequestingHost, int aRequestingPort, String aRequestingPrompt, String aRequestingProtocol, String aRequestingScheme, InetAddress aRequestingSite, URL aRequestingURL, Authenticator.RequestorType aRequestorType) TheAuthenticator
installed by this add-on will delegate to this method from itsAuthenticator.getPasswordAuthentication()
method.void
plugInto
(ILcyLucyEnv aLucyEnv) Creates and plugs in the add-on's preferences tool.void
unplugFrom
(ILcyLucyEnv aLucyEnv) Unplugs the add-on's preferences tool.Methods inherited from class com.luciad.lucy.addons.ALcyPreferencesAddOn
createPreferencesTool, getLongPrefix, getLucyEnv, getPreferences, getPreferencesTool, getShortPrefix
Methods inherited from class com.luciad.lucy.addons.ALcyAddOn
getConfigSourceName, getDisplayName, setConfigSourceName, setDisplayName
-
Constructor Details
-
TLcyNetworkConnectionAddOn
public TLcyNetworkConnectionAddOn()Creates the addon using the default preferences.
-
-
Method Details
-
plugInto
Description copied from class:ALcyPreferencesAddOn
Creates and plugs in the add-on's preferences tool.- Overrides:
plugInto
in classALcyPreferencesAddOn
- Parameters:
aLucyEnv
- the Lucy environment to plug into- See Also:
-
unplugFrom
Description copied from class:ALcyPreferencesAddOn
Unplugs the add-on's preferences tool.- Overrides:
unplugFrom
in classALcyPreferencesAddOn
- Parameters:
aLucyEnv
- the Lucy environment- See Also:
-
getPasswordAuthentication
protected PasswordAuthentication getPasswordAuthentication(String aRequestingHost, int aRequestingPort, String aRequestingPrompt, String aRequestingProtocol, String aRequestingScheme, InetAddress aRequestingSite, URL aRequestingURL, Authenticator.RequestorType aRequestorType) TheAuthenticator
installed by this add-on will delegate to this method from itsAuthenticator.getPasswordAuthentication()
method. The default implementation shows a dialog to the user requesting the user name and password. Overriding this method allows to provide hardcoded credentials for a certain server, while keeping the functionality of the dialog intact for other servers. For example:@Override protected PasswordAuthentication getPasswordAuthentication(String aRequestingHost, int aRequestingPort, String aRequestingPrompt, String aRequestingProtocol, String aRequestingScheme, InetAddress aRequestingSite, URL aRequestingURL, Authenticator.RequestorType aRequestorType ){ if(aRequestorType == RequestorType.SERVER && aRequestingHost != null && "my_host".equals(aRequestingHost){ //return hardcoded credentials for this specific server return new PasswordAuthentication("root", new char[]{'r','o','o','t'}); } //Show the dialog for all other connections return super.getPasswordAuthentication(aRequestingHost, aRequestingPort, aRequestingPrompt, aRequestingProtocol, aRequestingScheme, aRequestingSite, aRequestingURL, aRequestorType); }
Note: the
Authenticator
installed by this add-on is set as default Authenticator on the whole JVM. As a result, it is not possible to have 2 Lucy instances running in the same JVM which provide different credentials.- Parameters:
aRequestingHost
- SeeAuthenticator.getRequestingHost()
aRequestingPort
- SeeAuthenticator.getRequestingPort()
aRequestingPrompt
- SeeAuthenticator.getRequestingPrompt()
aRequestingProtocol
- SeeAuthenticator.getRequestingProtocol()
aRequestingScheme
- SeeAuthenticator.getRequestingScheme()
aRequestingSite
- SeeAuthenticator.getRequestingSite()
aRequestingURL
- SeeAuthenticator.getRequestingURL()
aRequestorType
- SeeAuthenticator.getRequestorType()
. Currently this method is not called forAuthenticator.RequestorType.PROXY
requests.- Returns:
- See
Authenticator.getPasswordAuthentication()
- Since:
- 2018.0
-