grails-app.services
Class SimplePasswordManagerService

java.lang.Object
  grails-app.services.SimplePasswordManagerService

class SimplePasswordManagerService

Very simple password management service. It does not aim to replace KeyStores, but those may be overkill for most cases. That does not mean that this won't be superseded in the future by an implementation using a KeyStore, but for now such an implementation would be excessive.


Field Summary
private static java.util.Hashtable cache

static int cacheDuration

boolean transactional

 
Constructor Summary
SimplePasswordManagerService()

 
Method Summary
static void flushCache()

Forgets all cached passwords

def retrieve(java.lang.String key, java.lang.String encryptionPassword = '')

Attempts to retrieve a data item by its key, and decrypt it with the provided decryption password.

EncryptedData store(java.lang.String key, java.lang.String data, java.lang.String encryptionPassword)

Encrypts and stores a data item using EncryptedData records.

 
Methods inherited from class java.lang.Object
hashCode, getClass, equals, toString, wait, wait, wait, notify, notifyAll
 

Field Detail

cache

private static java.util.Hashtable cache


cacheDuration

public static int cacheDuration


transactional

boolean transactional


 
Constructor Detail

SimplePasswordManagerService

SimplePasswordManagerService()


 
Method Detail

flushCache

public static void flushCache()
Forgets all cached passwords


retrieve

public def retrieve(java.lang.String key, java.lang.String encryptionPassword = '')
Attempts to retrieve a data item by its key, and decrypt it with the provided decryption password. If the decryption is successful, it will cache the password for the specified period of time.
param:
key Item ID to store
param:
encryptionPassword Encryption password originally used. Optional parameter, if not provided it will attempt to retrieve the value from the password cache.
return:
Decrypted string


store

EncryptedData store(java.lang.String key, java.lang.String data, java.lang.String encryptionPassword)
Encrypts and stores a data item using EncryptedData records. It will not cache the password.
param:
key Item ID to store
param:
data Plaintext data to encrypt
param:
encryptionPassword Encryption password to use
see:
EncryptedData


 

Groovy Documentation