de.jw.cloud42.webapp
Class UserManager

java.lang.Object
  extended by de.jw.cloud42.webapp.UserManager

@Name(value="userManager")
@Scope(value=SESSION)
public class UserManager
extends java.lang.Object

Holds current user and credentials. Also contains logic for managing the user's RSA private keys.

Author:
fbitzer

Constructor Summary
UserManager()
           
 
Method Summary
 void createAccount()
          Saves a new user.
 void deletePrivateKey(java.lang.String keypairName)
          Delete a private key for a keypair.
 AwsCredentials getCurrentCredentials()
           
 java.lang.String getKeyForName(java.lang.String keyName)
          Retreive a previously saved private key.
 User getUser()
           
 void newUser()
          Creates a new User instance.
 boolean privateKeyExists(java.lang.String keypairName)
          Checks whether a private key for the keypair with given name exists.
 void saveCredentials()
          Saves current credentials by assigning them to the user.
 void savePrivateKey(java.lang.String keypairName, java.lang.String privateKey)
          Stores a private key for a keypair in the database and maps it to the current user.
 void saveRegion()
          Saves current region.
 void setCurrentCredentials(AwsCredentials currentCredentials)
           
 void setUser(User user)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserManager

public UserManager()
Method Detail

getUser

public User getUser()
Returns:
the user

setUser

public void setUser(User user)
Parameters:
user - the user to set

getCurrentCredentials

public AwsCredentials getCurrentCredentials()
Returns:
the currentCredentials

setCurrentCredentials

public void setCurrentCredentials(AwsCredentials currentCredentials)
Parameters:
currentCredentials - the currentCredentials to set

newUser

public void newUser()
Creates a new User instance.


createAccount

public void createAccount()
Saves a new user.


saveCredentials

public void saveCredentials()
Saves current credentials by assigning them to the user.


saveRegion

public void saveRegion()
Saves current region.


savePrivateKey

public void savePrivateKey(java.lang.String keypairName,
                           java.lang.String privateKey)
Stores a private key for a keypair in the database and maps it to the current user. If there is already a key for a keypair with same name, it is overridden.

Parameters:
keypairName - name of the keypair.
privateKey - the private key to save.

privateKeyExists

public boolean privateKeyExists(java.lang.String keypairName)
Checks whether a private key for the keypair with given name exists.

Parameters:
keypairName - name of the keypair.
Returns:
true, if a private key for the keypair with given name exists, false else

deletePrivateKey

public void deletePrivateKey(java.lang.String keypairName)
Delete a private key for a keypair.

Parameters:
keypairName - the name of the keypair.

getKeyForName

public java.lang.String getKeyForName(java.lang.String keyName)
Retreive a previously saved private key.

Parameters:
keyName - the name of the keypair the key belongs to.
Returns:
RSA private key for given keypair or null if no key was found.


Copyright © 2010 just works! Software. All Rights Reserved.