Index: src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java (revision 41593) +++ src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java (working copy) @@ -149,8 +149,7 @@ OpenShiftUIActivator.PLUGIN_ID); String[] users = pref.get(); for (int i = 0; i < users.length; i++) { - String password = getPasswordFromSecureStorage(users[i]); - addUser(new UserDelegate(users[i], password)); + addUser(new UserDelegate(users[i])); } } @@ -216,9 +215,9 @@ * Return a password from secure storage, or null if platform not found, or password not stored */ public String getPasswordFromSecureStorage(final String rhLogin) { - if (rhLogin == null) + if (rhLogin == null) { return null; - + } SecurePasswordStore store = getSecureStore(rhLogin); if (store != null && rhLogin != null && !rhLogin.isEmpty()) { try { Index: src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java (revision 41593) +++ src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java (working copy) @@ -35,22 +35,25 @@ import com.openshift.client.OpenShiftUnknonwSSHKeyTypeException; public class UserDelegate { + private static final String NOT_LOADED = null; + + private static final String NOT_FOUND = ""; + private String username; private String password; private IUser delegate; private boolean rememberPassword; private boolean connected; private boolean alreadyPromptedForPassword; - - public UserDelegate(String username, String password) { + + public UserDelegate(String username) { this.username = username; - this.password = password; - this.rememberPassword = (password != null); this.setConnected(false); } - + public UserDelegate(IUser user, boolean rememberPassword) { setDelegate(user); + this.password = NOT_LOADED; this.rememberPassword = rememberPassword; } @@ -69,15 +72,30 @@ this.username = delegate.getRhlogin(); this.password = delegate.getPassword(); this.setConnected(true); - } + } public String getUsername() { return username; } public String getPassword() { + loadPassword(); return password; } - + + /** + * Attempts to load the password from the secure storage, only at first + * time it is called. + */ + private void loadPassword() { + if (password == NOT_LOADED) { + password = UserModel.getDefault().getPasswordFromSecureStorage(username); + rememberPassword = (password != null); + if(password == null) { + password = NOT_FOUND; + } + } + } + public boolean isRememberPassword() { return rememberPassword; } @@ -99,7 +117,8 @@ */ public boolean checkForPassword() { if(delegate == null) { - if( username != null && password != null ) { + loadPassword(); + if(username != null && password != null) { if( checkCurrentCredentials() ) return true; }