Package org.camunda.bpm.engine.rest.dto.identity

Examples of org.camunda.bpm.engine.rest.dto.identity.UserCredentialsDto


  }

  public void createInitialUser(String id, String password, String firstName, String lastName) {

    UserDto user = new UserDto();
    UserCredentialsDto credentials = new UserCredentialsDto();
    credentials.setPassword(password);
    user.setCredentials(credentials);
    UserProfileDto profile = new UserProfileDto();
    profile.setId(id);
    profile.setFirstName(firstName);
    profile.setLastName(lastName);
View Full Code Here


    Authentication authentication = MockProvider.createMockAuthentication();
    when(identityServiceMock.getCurrentAuthentication()).thenReturn(authentication);

    when(identityServiceMock.checkPassword(MockProvider.EXAMPLE_USER_ID, MockProvider.EXAMPLE_USER_PASSWORD)).thenReturn(false);

    UserCredentialsDto dto = new UserCredentialsDto();
    dto.setPassword("new-password");
    dto.setAuthenticatedUserPassword(MockProvider.EXAMPLE_USER_PASSWORD);

    given()
        .pathParam("id", MockProvider.EXAMPLE_USER_ID)
        .contentType(ContentType.JSON)
        .body(dto)
View Full Code Here

    UserQuery sampleUserQuery = mock(UserQuery.class);
    when(identityServiceMock.createUserQuery()).thenReturn(sampleUserQuery);
    when(sampleUserQuery.userId("aNonExistingUser")).thenReturn(sampleUserQuery);
    when(sampleUserQuery.singleResult()).thenReturn(null);

    UserCredentialsDto dto = new UserCredentialsDto();
    dto.setPassword("new-password");

    given()
        .pathParam("id", "aNonExistingUser")
        .body(dto).contentType(ContentType.JSON)
    .then()
View Full Code Here

    UserQuery sampleUserQuery = mock(UserQuery.class);
    when(identityServiceMock.createUserQuery()).thenReturn(sampleUserQuery);
    when(sampleUserQuery.userId(MockProvider.EXAMPLE_USER_ID)).thenReturn(sampleUserQuery);
    when(sampleUserQuery.singleResult()).thenReturn(initialUser);

    UserCredentialsDto dto = new UserCredentialsDto();
    dto.setPassword("new-password");

    given()
        .pathParam("id", MockProvider.EXAMPLE_USER_ID)
        .body(dto).contentType(ContentType.JSON)
    .then()
        .statusCode(Status.NO_CONTENT.getStatusCode())
    .when()
        .put(USER_CREDENTIALS_URL);

    // password was updated
    verify(initialUser).setPassword(dto.getPassword());

    // and then saved
    verify(identityServiceMock).saveUser(initialUser);
  }
View Full Code Here

    Authentication authentication = MockProvider.createMockAuthentication();
    when(identityServiceMock.getCurrentAuthentication()).thenReturn(authentication);

    when(identityServiceMock.checkPassword(MockProvider.EXAMPLE_USER_ID, MockProvider.EXAMPLE_USER_PASSWORD)).thenReturn(true);

    UserCredentialsDto dto = new UserCredentialsDto();
    dto.setPassword("new-password");
    dto.setAuthenticatedUserPassword(MockProvider.EXAMPLE_USER_PASSWORD);

    given()
        .pathParam("id", MockProvider.EXAMPLE_USER_ID)
        .contentType(ContentType.JSON)
        .body(dto)
    .then()
        .statusCode(Status.NO_CONTENT.getStatusCode())
    .when()
        .put(USER_CREDENTIALS_URL);

    verify(identityServiceMock).getCurrentAuthentication();
    verify(identityServiceMock).checkPassword(MockProvider.EXAMPLE_USER_ID, MockProvider.EXAMPLE_USER_PASSWORD);

    // password was updated
    verify(initialUser).setPassword(dto.getPassword());

    // and then saved
    verify(identityServiceMock).saveUser(initialUser);
  }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.rest.dto.identity.UserCredentialsDto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.