Class GnomeKeyringBackedSecureStore<E extends StoredSecret>
- java.lang.Object
-
- com.microsoft.credentialstorage.implementation.posix.keyring.GnomeKeyringBackedSecureStore<E>
-
- Type Parameters:
E- secret class to store
- All Implemented Interfaces:
SecretStore<E>
- Direct Known Subclasses:
GnomeKeyringBackedCredentialStore,GnomeKeyringBackedTokenPairStore,GnomeKeyringBackedTokenStore
public abstract class GnomeKeyringBackedSecureStore<E extends StoredSecret> extends Object implements SecretStore<E>
Base class for GNOME Keyring stores.
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringALLOW_UNLOCK_KEYRINGprotected static StringAPP_NAMEprotected static StringATTRIBUTE_ACCOUNTprotected static StringATTRIBUTE_KEYprotected static StringATTRIBUTE_TYPEprotected static GnomeKeyringLibraryINSTANCEprotected static org.slf4j.Loggerloggerprotected static GnomeKeyringLibrary.GnomeKeyringPasswordSchemaSCHEMA
-
Constructor Summary
Constructors Constructor Description GnomeKeyringBackedSecureStore()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static booleancheckResult(int retCode, String message)protected abstract Ecreate(String username, char[] secret)Create aSecretfrom the string representationbooleandelete(String key)Delete a secret from GNOME Keyring.protected intdeleteSecret(String key)Eget(String key)Read a secret from GNOME Keyring using its item API to get attributes containing username.protected abstract StringgetType()Return the type of this secure store, used to match the secret in GNOME KeyringbooleanisSecure()GNOME Keyring is considered securestatic booleanisSupported()protected <T> TreadSecret(String key, BiFunction<String,char[],T> mapper)protected intwriteSecret(String key, String account, char[] secret)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.microsoft.credentialstorage.SecretStore
add
-
-
-
-
Field Detail
-
logger
protected static final org.slf4j.Logger logger
-
INSTANCE
protected static final GnomeKeyringLibrary INSTANCE
-
SCHEMA
protected static final GnomeKeyringLibrary.GnomeKeyringPasswordSchema SCHEMA
-
APP_NAME
protected static final String APP_NAME
- See Also:
- Constant Field Values
-
ALLOW_UNLOCK_KEYRING
protected static final String ALLOW_UNLOCK_KEYRING
- See Also:
- Constant Field Values
-
ATTRIBUTE_TYPE
protected static final String ATTRIBUTE_TYPE
- See Also:
- Constant Field Values
-
ATTRIBUTE_KEY
protected static final String ATTRIBUTE_KEY
- See Also:
- Constant Field Values
-
ATTRIBUTE_ACCOUNT
protected static final String ATTRIBUTE_ACCOUNT
- See Also:
- Constant Field Values
-
-
Method Detail
-
get
public E get(String key)
Read a secret from GNOME Keyring using its item API to get attributes containing username.- Specified by:
getin interfaceSecretStore<E extends StoredSecret>- Parameters:
key- for which a secret is associated with- Returns:
- secret
-
delete
public boolean delete(String key)
Delete a secret from GNOME Keyring.- Specified by:
deletein interfaceSecretStore<E extends StoredSecret>- Parameters:
key- for which a secret is associated with- Returns:
- true if operation succeeded
-
isSecure
public boolean isSecure()
GNOME Keyring is considered secure- Specified by:
isSecurein interfaceSecretStore<E extends StoredSecret>- Returns:
truefor GNOME Keyring
-
isSupported
public static boolean isSupported()
-
create
protected abstract E create(String username, char[] secret)
Create aSecretfrom the string representation- Parameters:
username- username for the secretsecret- password, oauth2 access token, or Personal Access Token- Returns:
- a
Secretfrom the input
-
getType
protected abstract String getType()
Return the type of this secure store, used to match the secret in GNOME Keyring- Returns:
- type string representation of the secret type
-
readSecret
protected <T> T readSecret(String key, BiFunction<String,char[],T> mapper)
-
deleteSecret
protected int deleteSecret(String key)
-
checkResult
protected static boolean checkResult(int retCode, String message)
-
-