Package net.shibboleth.idp.cli
Class AbstractCommandLineArguments
java.lang.Object
net.shibboleth.idp.cli.AbstractCommandLineArguments
- All Implemented Interfaces:
CommandLineArguments
- Direct Known Subclasses:
MetadataQueryArguments
,ReloadMetadataArguments
,ReloadServiceArguments
,ResolverTestArguments
,StatusArguments
Base class for JCommander command line argument handling for an HTTP-based remote service call,
with an abstract method that adds to a URL based on a derived class' arguments.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Name of system property for overriding default URL.private boolean
Disable TLS certificate name checking.HTTP header name/value pair(s).private boolean
Display command usage.private String
HTTP method to use, GET by default.private String
Password to be used in the HTTP-Basic authentication.private String
Path to add to base URL.private String
Trust store for SSL connectivity.private String
Trust store password for SSL connectivity.private String
Trust store type for SSL connectivity.private String
Base of URL to invoke.private String
Username to be used in the HTTP-Basic authentication. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildURL()
Compute the full URL to connect to.protected StringBuilder
doBuildURL
(StringBuilder builder) Override this method to modify the eventual URL and attach any parameters.Builds the HTTP-Basic value to be used in the Authorization -header, containing username and password.Values of "header" parameter.boolean
getHelp()
Value of "help" parameter.Value of "method" parameter.Value of "password" parameter.getPath()
Value of "path" parameter.Value of "trustStore" parameter.Value of "trustStorePassword" parameter.Value of "trustStoreType" parameter.getURL()
Value of "url" parameter.Value of "username" parameter.private void
Use the configured parameters to set global JVM trust store parameters for SSL connectivity.boolean
Value of "disableNameChecking" parameter.boolean
isUsage()
Should command usage be displayed?void
validate()
Validate the parameter set.
-
Field Details
-
BASEURL_PROPERTY
Name of system property for overriding default URL.- See Also:
-
help
private boolean helpDisplay command usage. -
url
Base of URL to invoke. -
path
Path to add to base URL. -
disableNameChecking
private boolean disableNameCheckingDisable TLS certificate name checking. -
trustStore
Trust store for SSL connectivity. -
trustStoreType
Trust store type for SSL connectivity. -
trustStorePassword
Trust store password for SSL connectivity. -
username
Username to be used in the HTTP-Basic authentication. -
password
Password to be used in the HTTP-Basic authentication. -
method
HTTP method to use, GET by default. -
headers
HTTP header name/value pair(s).
-
-
Constructor Details
-
AbstractCommandLineArguments
public AbstractCommandLineArguments()Constructor.
-
-
Method Details
-
getHelp
public boolean getHelp()Value of "help" parameter.- Returns:
- parameter value
-
getURL
Value of "url" parameter.Defaults to http://localhost
- Returns:
- parameter value
-
getPath
Value of "path" parameter.- Returns:
- parameter value
-
getTrustStore
Value of "trustStore" parameter.- Returns:
- parameter value
-
getTrustStoreType
Value of "trustStoreType" parameter.- Returns:
- parameter value
-
getTrustStorePassword
Value of "trustStorePassword" parameter.- Returns:
- parameter value
-
isDisableNameChecking
public boolean isDisableNameChecking()Value of "disableNameChecking" parameter.- Returns:
- parameter value
-
getUsername
Value of "username" parameter.- Returns:
- username parameter
- Since:
- 4.2.0
-
getPassword
Value of "password" parameter.- Returns:
- password parameter
- Since:
- 4.2.0
-
getMethod
Value of "method" parameter.- Specified by:
getMethod
in interfaceCommandLineArguments
- Returns:
- method
- Since:
- 4.2.0
-
getHeaders
Values of "header" parameter.- Specified by:
getHeaders
in interfaceCommandLineArguments
- Returns:
- header parameter
-
isUsage
public boolean isUsage()Should command usage be displayed?- Specified by:
isUsage
in interfaceCommandLineArguments
- Returns:
- true iff this is a help request
-
validate
public void validate()Validate the parameter set.- Specified by:
validate
in interfaceCommandLineArguments
-
buildURL
Compute the full URL to connect to.- Specified by:
buildURL
in interfaceCommandLineArguments
- Returns:
- the URL to connect to
- Throws:
MalformedURLException
- if the URL constructed is invalid
-
doBuildURL
Override this method to modify the eventual URL and attach any parameters.- Parameters:
builder
- contains the URL in a partial state of construction, possibly including query string- Returns:
- a builder containing the modified URL string
-
getBasicAuthHeader
Builds the HTTP-Basic value to be used in the Authorization -header, containing username and password.- Specified by:
getBasicAuthHeader
in interfaceCommandLineArguments
- Returns:
- The value to be used in the Authorization -header, or null if username or password didn't have a value.
-
installTrustStore
private void installTrustStore()Use the configured parameters to set global JVM trust store parameters for SSL connectivity.
-