use of com.emc.storageos.vasa.fault.SOSAuthenticationFailure in project coprhd-controller by CoprHD.
the class SyncManager method verifyLogin.
/**
* Makes call to Bourne to verify login attempt
*
* @param username
* @param password
* @throws SOSAuthenticationFailure
* on invalid login attempt
* @throws SOSFailure
*/
public synchronized void verifyLogin(String username, String password) throws SOSAuthenticationFailure, SOSFailure {
final String methodName = "verifyLogin(): ";
final String FILE_COS_LIST_URI = "/file/vpools";
try {
_client.setLoginCredentials(username, password);
_client.queryObject(FILE_COS_LIST_URI, String.class);
} catch (NoSuchAlgorithmException e) {
log.error(methodName + "NoSuchAlgorithmException occured", e);
throw new SOSFailure(e);
} catch (UniformInterfaceException e) {
if (e.toString().contains("403 Forbidden")) {
throw new SOSAuthenticationFailure("Incorrect login credentials");
}
if (e.toString().contains("401 Unauthorized")) {
throw new SOSAuthenticationFailure("Incorrect login credentials");
}
}
}
Aggregations