Class LibSecretBackedSecureStore<E extends StoredSecret>

    • Constructor Detail

      • LibSecretBackedSecureStore

        public LibSecretBackedSecureStore()
    • Method Detail

      • get

        public E get​(String key)
        Read a secret from Libsecret using its item API to get attributes containing username.
        Specified by:
        get in interface SecretStore<E extends StoredSecret>
        Parameters:
        key - for which a secret is associated with
        Returns:
        secret
      • delete

        public boolean delete​(String key)
        Delete a secret from Libsecret.
        Specified by:
        delete in interface SecretStore<E extends StoredSecret>
        Parameters:
        key - for which a secret is associated with
        Returns:
        true if operation succeeded
      • isSecure

        public boolean isSecure()
        Libsecret is considered secure
        Specified by:
        isSecure in interface SecretStore<E extends StoredSecret>
        Returns:
        true for Libsecret
      • isSupported

        public static boolean isSupported()
      • create

        protected abstract E create​(String username,
                                    char[] secret)
        Create a Secret from the string representation
        Parameters:
        username - username for the secret
        secret - password, oauth2 access token, or Personal Access Token
        Returns:
        a Secret from the input
      • getType

        protected abstract String getType()
        Return the type of this secure store, used to match the secret in Libsecret
        Returns:
        type string representation of the secret type
      • isLibSecretSupported

        public static boolean isLibSecretSupported()
        Check for Libsecret support on this platform
        Returns:
        true if Libsecret library is available; false otherwise
      • writeSecret

        protected boolean writeSecret​(String key,
                                      String account,
                                      char[] secret,
                                      com.sun.jna.ptr.PointerByReference error)
      • deleteSecret

        protected boolean deleteSecret​(String key,
                                       com.sun.jna.ptr.PointerByReference error)
      • checkResult

        protected static boolean checkResult​(com.sun.jna.ptr.PointerByReference error,
                                             String message)