Dekoh platform API

dekoh.portal.password
Class SecurePasswordStoreFactory

java.lang.Object
  extended by dekoh.portal.password.SecurePasswordStoreFactory

public class SecurePasswordStoreFactory
extends Object

SecurePasswordStoreFactory returns instances of SecurePasswordStore for Dekoh applications. Each Dekoh user gets a different instance of password store for the same application.

Following sample code demonstrates how to use this factory :

 public void contextInitialized(ServletContextEvent sce) {
  SecurePasswordStoreFactory factory = SecurePasswordStoreFactory.getAppPasswordStoreFactory();
  sce.getServletContext().setAttribute("myAppsPasswordStoreFactory", factory);
 }
 ....
 

void storePassword(HttpServletRequest request, String password) { ServletContext servletContext = request.getSession().getServletContext(); SecurePasswordStore userPasswordStore = servletContext.getAttribute("myAppsPasswordStoreFactory").getDekohUserPasswordStore(request); userPasswordStore.storePassword(password); }

Since:
Nov 20, 2007

Method Summary
static SecurePasswordStoreFactory getAppPasswordStoreFactory()
           
 PasswordStore getDekohUserPasswordStore(DesktopUser user)
          Caller application is expected to manage the returned instance user's password store instance, such that only one instance (per user) is available.
 PasswordStore getDekohUserPasswordStore(HttpServletRequest request)
          Gets an already open password store or opens the password store of current Dekoh user using his master password for the accessing application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAppPasswordStoreFactory

public static SecurePasswordStoreFactory getAppPasswordStoreFactory()
Returns:
instance of this factory which will be capable of creating SecurePasswordStore instances for Dekoh users. It is important that this method be called with-in a Web request/ servlet context initialization.

getDekohUserPasswordStore

public PasswordStore getDekohUserPasswordStore(DesktopUser user)
                                        throws IOException
Caller application is expected to manage the returned instance user's password store instance, such that only one instance (per user) is available. The returned password store instance can be stored in HttpSession.

Using method SecurePasswordStoreFactory.getDekohUserPasswordStore(javax.servlet.http.HttpServletRequest) will relieve caller application of the headache of managing the user's password store instance.

Parameters:
user -
Returns:
password store instance
Throws:
IOException

getDekohUserPasswordStore

public PasswordStore getDekohUserPasswordStore(HttpServletRequest request)
                                        throws IOException
Gets an already open password store or opens the password store of current Dekoh user using his master password for the accessing application. The master password is obtained according to the policy chosen by acessing user.

The opened password store object is kept the accessing application's HTTP session and subsequent calls to this method will return this object from the sesion.

Parameters:
request - http request object, derives the logged in Dekoh user from this object, puts the created password store in the session of this request object
Returns:
a PasswordStore to store/retrive passwords
Throws:
IOException - when user data directory could not be created.
com.pramati.bfly.das.password.exception.IncorrectMasterPasswordException
com.pramati.bfly.das.password.exception.DekohUserNotLoggedInException

Dekoh platform API

© 2009 Pramati Technologies - Dekoh - Portal for Developers