use of com.emc.storageos.model.password.PasswordUpdateParam in project coprhd-controller by CoprHD.
the class PasswordServiceTest method testUpdatePasswordTooManyParams.
@Test(expected = BadRequestException.class)
public void testUpdatePasswordTooManyParams() {
PasswordService passwordResource = new PasswordService();
passwordResource.setPropertiesMetadata(_propertiesMetadata);
passwordResource.setAuditLogManager(new DummyAuditLogManager());
PasswordUpdateParam passwordUpdate = getDummyPasswordUpdate("clearTextPwd", "HashedPassword");
LocalPasswordHandler ph = getPasswordHandler();
ph.setLocalUsers(createLocalUsers());
passwordResource.setPasswordHandler(ph);
SecurityContext sc = new DummySecurityContext(LOCAL_ROOT);
passwordResource.setSecurityContext(sc);
Response res = passwordResource.updatePassword(null, null, passwordUpdate, false);
}
use of com.emc.storageos.model.password.PasswordUpdateParam in project coprhd-controller by CoprHD.
the class PasswordServiceTest method getDummyPasswordUpdate.
public PasswordUpdateParam getDummyPasswordUpdate(String password, String encpassword) {
PasswordUpdateParam passwordUpdate = new PasswordUpdateParam();
passwordUpdate.setPassword(password);
passwordUpdate.setEncPassword(encpassword);
return passwordUpdate;
}
use of com.emc.storageos.model.password.PasswordUpdateParam in project coprhd-controller by CoprHD.
the class Password method update.
/**
* Change an authenticated local user's own password. Accepts a clear test
* password or a password already hashed by the caller. If both form fields
* are specified, bad request will be returned.
* <p>
* API Call: PUT /password
*
* @param password The clear text or encrypted password
* @param encrypted If true, the supplied password is already hashed
* @param logoutUser If true, logout the user after updating the password
*/
public void update(String oldPassword, String password, boolean encrypted, boolean logoutUser) {
PasswordUpdateParam param = new PasswordUpdateParam();
param.setOldPassword(oldPassword);
if (encrypted) {
param.setEncPassword(password);
} else {
param.setPassword(password);
}
client.putURI(String.class, param, client.uriBuilder(PASSWORD_URL).queryParam("logout_user", logoutUser).build());
}
use of com.emc.storageos.model.password.PasswordUpdateParam in project coprhd-controller by CoprHD.
the class Password method validateUpdate.
/**
* an authenticated local user validates its proposed password change.
* If validation passes, it will return an http 204 status code (no content).
* If validation fails, it will throw a ServiceErrorException with an http 400 status code (bad parameters).
*
* <p>
* API Call: POST /password/validate-update
*/
public void validateUpdate(String oldPassword, String password) throws Exception {
PasswordUpdateParam input = new PasswordUpdateParam();
input.setOldPassword(oldPassword);
input.setPassword(password);
client.post(input, VALIDATE_PASSWORD_UPDATE_URL);
}
Aggregations