Class Keyring

    • Method Detail

      • create

        public static Keyring create()
                              throws BackendNotSupportedException
        Creates an instance of Keyring using the a default backed based on operating system.
        Returns:
        a functional Keyring or a BackendNotSupportedException is thrown.
        Throws:
        BackendNotSupportedException - if the default backend for the operating system is unsupported.
      • getPassword

        public String getPassword​(String service,
                                  String account)
                           throws PasswordAccessException
        Gets password from key store (Proxy method of KeyringBackend.getPassword).
        Parameters:
        service - Service name
        account - Account name
        Returns:
        Password related to specified service and account
        Throws:
        PasswordAccessException - Thrown when an error happened while getting password
      • setPassword

        public void setPassword​(String service,
                                String account,
                                String password)
                         throws PasswordAccessException
        Sets password to key store (Proxy method of KeyringBackend.setPassword)
        Parameters:
        service - Service name
        account - Account name
        password - Password
        Throws:
        PasswordAccessException - Thrown when an error happened while saving the password
      • deletePassword

        public void deletePassword​(String service,
                                   String account)
                            throws PasswordAccessException
        Sets password to key store (Proxy method of KeyringBackend.setPassword)
        Parameters:
        service - Service name
        account - Account name
        Throws:
        PasswordAccessException - Thrown when an error happened while saving the password
      • close

        public void close()
                   throws Exception
        Closes resources used by the backend.
        Specified by:
        close in interface AutoCloseable
        Throws:
        Exception - Thrown if the backend can not be closed