Package aQute.bnd.url
Class BndAuthentication
java.lang.Object
aQute.bnd.url.DefaultURLConnectionHandler
aQute.bnd.url.BndAuthentication
- All Implemented Interfaces:
Plugin
,RegistryPlugin
,URLConnectionHandler
,Report
,Reporter
bnd has a builtin delegated authentication mechanism, see
Settings
.
This URL Connection Handler plugin will use this information to add signing
information to the URL.
We add a X_A_QUTE_AUTHORIZATION
header with a formatted string that
contains the email of the user, the machine name (for documentation), the
public key, and a signed date header (SHA1WithRSA). This information can be
parameterized with the following plugin properties or the default settings
can be used.
MATCH
— URL matcheremail
— Email address of the account holderprivateKey
— Hex private RSA keypublicKey
— Hex public RSA keymachine
— Machine name (defaults to the internet name of this machine as returned by invokingInetAddress.getHostName()
on theInetAddress
returned byInetAddress.getLocalHost()
)
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface aQute.service.reporter.Report
Report.Location
Nested classes/interfaces inherited from interface aQute.service.reporter.Reporter
Reporter.SetLocation
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private static final String
private String
private static final org.slf4j.Logger
private String
private static final String
private static final String
private PrivateKey
private static final String
private PublicKey
private static final String
Fields inherited from class aQute.bnd.url.DefaultURLConnectionHandler
registry
Fields inherited from interface aQute.bnd.service.url.URLConnectionHandler
MATCH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
credentials
(String email, byte[] publicKey, byte[] privateKey) void
handle
(URLConnection connection) Not doing anything is perfect okprivate void
init()
void
setProperties
(Map<String, String> map) Set the properties for this plugin.Methods inherited from class aQute.bnd.url.DefaultURLConnectionHandler
addMatcher, error, exception, getErrors, getLocation, getWarnings, isOk, isPedantic, matches, matches, progress, setRegistry, setReporter, trace, warning
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
MACHINE
- See Also:
-
PRIVATE_KEY
- See Also:
-
PUBLIC_KEY
- See Also:
-
EMAIL
- See Also:
-
X_A_QUTE_AUTHORIZATION
- See Also:
-
identity
-
email
-
machine
-
privateKey
-
publicKey
-
-
Constructor Details
-
BndAuthentication
public BndAuthentication()
-
-
Method Details
-
handle
Description copied from class:DefaultURLConnectionHandler
Not doing anything is perfect ok- Specified by:
handle
in interfaceURLConnectionHandler
- Overrides:
handle
in classDefaultURLConnectionHandler
- Parameters:
connection
- The connection to modify- Throws:
Exception
-
init
- Throws:
UnknownHostException
-
setProperties
Description copied from class:DefaultURLConnectionHandler
Set the properties for this plugin. Subclasses should call this method before they handle their own properties.- Specified by:
setProperties
in interfacePlugin
- Overrides:
setProperties
in classDefaultURLConnectionHandler
- Parameters:
map
- attributes and directives for this plugin's clause- Throws:
Exception
-
credentials
private void credentials(String email, byte[] publicKey, byte[] privateKey) throws InvalidKeySpecException, NoSuchAlgorithmException
-