Package aQute.bnd.url

Class BndAuthentication

  • All Implemented Interfaces:
    Plugin, RegistryPlugin, URLConnectionHandler, Report, Reporter

    public class BndAuthentication
    extends DefaultURLConnectionHandler
    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 matcher
    • email — Email address of the account holder
    • privateKey — Hex private RSA key
    • publicKey — Hex public RSA key
    • machine — Machine name (defaults to the internet name of this machine as returned by invoking InetAddress.getHostName() on the InetAddress returned by InetAddress.getLocalHost())
    • Field Detail

      • logger

        private static final org.slf4j.Logger logger
      • httpFormat

        private static java.text.SimpleDateFormat httpFormat
      • 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
    • Constructor Detail

      • BndAuthentication

        public BndAuthentication()
    • Method Detail

      • 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.Exception
        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 interface Plugin
        Overrides:
        setProperties in class DefaultURLConnectionHandler
        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.InvalidKeySpecException
        java.security.NoSuchAlgorithmException