Search in sources :

Example 6 with PasswordUpdateParam

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);
}
Also used : Response(javax.ws.rs.core.Response) SecurityContext(javax.ws.rs.core.SecurityContext) PasswordUpdateParam(com.emc.storageos.model.password.PasswordUpdateParam) LocalPasswordHandler(com.emc.storageos.systemservices.impl.util.LocalPasswordHandler) Test(org.junit.Test)

Example 7 with PasswordUpdateParam

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;
}
Also used : PasswordUpdateParam(com.emc.storageos.model.password.PasswordUpdateParam)

Example 8 with PasswordUpdateParam

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());
}
Also used : PasswordUpdateParam(com.emc.storageos.model.password.PasswordUpdateParam)

Example 9 with PasswordUpdateParam

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);
}
Also used : PasswordUpdateParam(com.emc.storageos.model.password.PasswordUpdateParam)

Aggregations

PasswordUpdateParam (com.emc.storageos.model.password.PasswordUpdateParam)9 LocalPasswordHandler (com.emc.storageos.systemservices.impl.util.LocalPasswordHandler)6 Response (javax.ws.rs.core.Response)6 Test (org.junit.Test)6 SecurityContext (javax.ws.rs.core.SecurityContext)5 DummyDbClient (com.emc.storageos.util.DummyDbClient)1