use of org.jboss.tools.foundation.core.credentials.UsernameChangedException in project jbosstools-openshift by jbosstools.
the class CDKLaunchEnvironmentUtil method createEnvironment.
public static Map<String, String> createEnvironment(IServer server, boolean skipCredentials) {
CDKServer cdkServer = (CDKServer) server.loadAdapter(CDKServer.class, new NullProgressMonitor());
boolean passCredentials = cdkServer.passCredentials();
String pass = null;
if (passCredentials && !skipCredentials) {
try {
pass = cdkServer.getPassword();
} catch (UsernameChangedException uce) {
return createEnvironment(server, uce.getPassword(), uce.getUser());
}
}
return createEnvironment(server, pass);
}
use of org.jboss.tools.foundation.core.credentials.UsernameChangedException in project jbosstools-openshift by jbosstools.
the class CDKServer method getPassword.
public String getPassword() throws UsernameChangedException {
ControllableServerBehavior beh = (ControllableServerBehavior) getServer().loadAdapter(ControllableServerBehavior.class, new NullProgressMonitor());
Object pw = beh.getSharedData(CDKServerBehaviour.PROP_CACHED_PASSWORD);
if (pw instanceof String)
return (String) pw;
ICredentialDomain domain = CredentialService.getCredentialModel().getDomain(CredentialService.REDHAT_ACCESS);
String user = getUsername();
if (user != null && domain != null) {
try {
return domain.getCredentials(user);
} catch (StorageException se) {
CDKCoreActivator.getDefault().getLog().log(new Status(IStatus.ERROR, CDKCoreActivator.PLUGIN_ID, se.getMessage(), se));
} catch (UsernameChangedException uce) {
if (uce.getSaveCredentials()) {
saveChangedCredentials(uce);
}
throw uce;
}
}
return null;
}
use of org.jboss.tools.foundation.core.credentials.UsernameChangedException in project jbosstools-openshift by jbosstools.
the class CDKLaunchUtility method getUserPass.
private static final String[] getUserPass(IServer server) {
final CDKServer cdkServer = (CDKServer) server.loadAdapter(CDKServer.class, new NullProgressMonitor());
String user = cdkServer.getUsername();
String pass = null;
try {
pass = cdkServer.getPassword();
} catch (UsernameChangedException uce) {
pass = uce.getPassword();
user = uce.getUser();
}
return new String[] { user, pass };
}
Aggregations