Package org.faceless.publisher.type
Class PasswordAuthenticationURLConnectionProcessor
java.lang.Object
org.faceless.publisher.type.AbstractURLConnectionProcessor
org.faceless.publisher.type.PasswordAuthenticationURLConnectionProcessor
- All Implemented Interfaces:
URLConnectionProcessor
A
URLConnectionProcessor
that handles password authentication. Basic and Digest
challenges are supported, anything else is passed to "challengeUnknown" which could be overridden
if required.-
Constructor Summary
ConstructorDescriptionCreate a new PasswordAuthenticationURLConnectionProcessor that will call the CallbackHandler fromReport.getCallbackHandler()
PasswordAuthenticationURLConnectionProcessor
(String name, char[] password) Create a new PasswordAuthenticationURLConnectionProcessor.Create a new PasswordAuthenticationURLConnectionProcessor that will call the specified CallbackHandler to retrieve the password. -
Method Summary
Modifier and TypeMethodDescriptionafter
(URL2Connection con) If this processermatches
, this method is called after the supplied URL connection is made.challengeBasic
(URL2Connection con, Map<String, String> props, CallbackHandler handler) Handle a Basic challengechallengeDigest
(URL2Connection con, Map<String, String> props, CallbackHandler handler) Handle a Digest challengechallengeUnknown
(URL2Connection con, String type, Map<String, String> props, CallbackHandler handler) Handle an unrecognised challenge typeReturn the list of patterns which will be matched to theRealm
of the password before this password is applied.Methods inherited from class org.faceless.publisher.type.AbstractURLConnectionProcessor
before, getMatches, matches
-
Constructor Details
-
PasswordAuthenticationURLConnectionProcessor
public PasswordAuthenticationURLConnectionProcessor()Create a new PasswordAuthenticationURLConnectionProcessor that will call the CallbackHandler fromReport.getCallbackHandler()
-
PasswordAuthenticationURLConnectionProcessor
Create a new PasswordAuthenticationURLConnectionProcessor that will call the specified CallbackHandler to retrieve the password. The handler should expect aNameCallback
andPasswordCallback
in normal use.- Parameters:
handler
- the handler to ask for name/password
-
PasswordAuthenticationURLConnectionProcessor
Create a new PasswordAuthenticationURLConnectionProcessor.- Parameters:
name
- the namepassword
- the password
-
-
Method Details
-
getRealmMatches
Return the list of patterns which will be matched to theRealm
of the password before this password is applied. If the list is left empty (the default) then it always matches -
after
Description copied from interface:URLConnectionProcessor
If this processermatches
, this method is called after the supplied URL connection is made. It can act on the response headers, modify them for the next processor, and if it returns non-null, the request headers and URI of the returned value will be used for another request. For example to implement a redirect on a return code of 301if (con.getCode() == 301) { con.setURI(parse(con.getResponseHeader("location"))); return con; } else { return null; }
- Specified by:
after
in interfaceURLConnectionProcessor
- Overrides:
after
in classAbstractURLConnectionProcessor
- Parameters:
con
- the connection- Returns:
- the next connection to make, or
null
to accept this response - Throws:
IOException
-
challengeBasic
public String challengeBasic(URL2Connection con, Map<String, String> props, CallbackHandler handler) throws IOExceptionHandle a Basic challenge- Parameters:
con
- the connectionprops
- the propertieshandler
- the handler to call for the name and password- Returns:
- the value of the Authentication header, or null to set no header
- Throws:
IOException
-
challengeDigest
public String challengeDigest(URL2Connection con, Map<String, String> props, CallbackHandler handler) throws IOExceptionHandle a Digest challenge- Parameters:
con
- the connectionprops
- the propertieshandler
- the handler to call for the name and password- Returns:
- the value of the Authentication header, or null to set no header
- Throws:
IOException
-
challengeUnknown
public String challengeUnknown(URL2Connection con, String type, Map<String, String> props, CallbackHandler handler) throws IOExceptionHandle an unrecognised challenge type- Parameters:
con
- the connectiontype
- the challengeprops
- the propertieshandler
- the handler to call for the name and password- Returns:
- the value of the Authentication header, or null to set no header
- Throws:
IOException
-