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
public class BndAuthentication extends DefaultURLConnectionHandler
bnd has a builtin delegated authentication mechanism, seeSettings. This URL Connection Handler plugin will use this information to add signing information to the URL.We add a
X_A_QUTE_AUTHORIZATIONheader 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 theInetAddressreturned byInetAddress.getLocalHost())
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interfaceBndAuthentication.Config-
Nested 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
Fields Modifier and Type Field Description private java.lang.Stringemailprivate static java.lang.StringEMAILprivate java.lang.Stringidentityprivate static org.slf4j.Loggerloggerprivate java.lang.Stringmachineprivate static java.lang.StringMACHINEprivate static java.lang.StringPRIVATE_KEYprivate java.security.PrivateKeyprivateKeyprivate static java.lang.StringPUBLIC_KEYprivate java.security.PublicKeypublicKeyprivate static java.lang.StringX_A_QUTE_AUTHORIZATION-
Fields inherited from class aQute.bnd.url.DefaultURLConnectionHandler
registry
-
Fields inherited from interface aQute.bnd.service.url.URLConnectionHandler
MATCH
-
-
Constructor Summary
Constructors Constructor Description BndAuthentication()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcredentials(java.lang.String email, byte[] publicKey, byte[] privateKey)voidhandle(java.net.URLConnection connection)Not doing anything is perfect okprivate voidinit()voidsetProperties(java.util.Map<java.lang.String,java.lang.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 Detail
-
logger
private static final org.slf4j.Logger logger
-
MACHINE
private static final java.lang.String MACHINE
- See Also:
- Constant Field Values
-
PRIVATE_KEY
private static final java.lang.String PRIVATE_KEY
- See Also:
- Constant Field Values
-
PUBLIC_KEY
private static final java.lang.String PUBLIC_KEY
- See Also:
- Constant Field Values
-
EMAIL
private static final java.lang.String EMAIL
- See Also:
- Constant Field Values
-
X_A_QUTE_AUTHORIZATION
private static final java.lang.String X_A_QUTE_AUTHORIZATION
- See Also:
- Constant Field Values
-
identity
private java.lang.String identity
-
email
private java.lang.String email
-
machine
private java.lang.String machine
-
privateKey
private java.security.PrivateKey privateKey
-
publicKey
private java.security.PublicKey publicKey
-
-
Method Detail
-
handle
public void handle(java.net.URLConnection connection) throws java.lang.ExceptionDescription copied from class:DefaultURLConnectionHandlerNot doing anything is perfect ok- Specified by:
handlein interfaceURLConnectionHandler- Overrides:
handlein classDefaultURLConnectionHandler- Parameters:
connection- The connection to modify- Throws:
java.lang.Exception
-
init
private void init() throws java.net.UnknownHostException- Throws:
java.net.UnknownHostException
-
setProperties
public void setProperties(java.util.Map<java.lang.String,java.lang.String> map) throws java.lang.ExceptionDescription copied from class:DefaultURLConnectionHandlerSet the properties for this plugin. Subclasses should call this method before they handle their own properties.- Specified by:
setPropertiesin interfacePlugin- Overrides:
setPropertiesin classDefaultURLConnectionHandler- Parameters:
map- attributes and directives for this plugin's clause- Throws:
java.lang.Exception
-
credentials
private void credentials(java.lang.String email, byte[] publicKey, byte[] privateKey) throws java.security.spec.InvalidKeySpecException, java.security.NoSuchAlgorithmException- Throws:
java.security.spec.InvalidKeySpecExceptionjava.security.NoSuchAlgorithmException
-
-