Java Code Examples for org.flowable.idm.api.User#setLastName()
The following examples show how to use
org.flowable.idm.api.User#setLastName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CreateUserAndMembershipTestDelegate.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void execute(DelegateExecution execution) { IdentityService identityService = Context.getProcessEngineConfiguration().getIdentityService(); String username = "Kermit"; User user = identityService.newUser(username); user.setPassword("123"); user.setFirstName("Manually"); user.setLastName("created"); identityService.saveUser(user); // Add admin group Group group = identityService.newGroup("admin"); identityService.saveGroup(group); identityService.createMembership(username, "admin"); }
Example 2
Source File: Bootstrapper.java From flowable-engine with Apache License 2.0 | 6 votes |
protected User initializeAdminUser() { FlowableIdmAppProperties.Admin adminConfig = idmAppProperties.getAdmin(); String adminUserId = adminConfig.getUserId(); Assert.notNull(adminUserId, "flowable.idm.app.admin.user-id property must be set"); String adminPassword = adminConfig.getPassword(); Assert.notNull(adminPassword, "flowable.idm.app.admin.password property must be set"); String adminFirstname = adminConfig.getFirstName(); Assert.notNull(adminFirstname, "flowable.idm.app.admin.first-name property must be set"); String adminLastname = adminConfig.getLastName(); Assert.notNull(adminLastname, "flowable.idm.app.admin.last-name property must be set"); String adminEmail = adminConfig.getEmail(); User admin = identityService.newUser(adminUserId); admin.setFirstName(adminFirstname); admin.setLastName(adminLastname); admin.setEmail(adminEmail); admin.setPassword(adminPassword); identityService.saveUser(admin); return admin; }
Example 3
Source File: IdentityServiceTest.java From flowable-engine with Apache License 2.0 | 6 votes |
@Test public void testCreateUserWithoutTenantId() { // First, create a new user User user = identityService.newUser("johndoe"); user.setFirstName("John"); user.setLastName("Doe"); user.setEmail("[email protected]"); identityService.saveUser(user); // Fetch and update the user user = identityService.createUserQuery().userId("johndoe").singleResult(); assertThat(user.getFirstName()).isEqualTo("John"); assertThat(user.getLastName()).isEqualTo("Doe"); assertThat(user.getEmail()).isEqualTo("[email protected]"); assertThat(user.getTenantId()).isNull(); identityService.deleteUser(user.getId()); }
Example 4
Source File: UserQueryEscapeClauseTest.java From flowable-engine with Apache License 2.0 | 5 votes |
private User createUser(String id, String firstName, String lastName, String email) { User user = idmIdentityService.newUser(id); user.setFirstName(firstName); user.setLastName(lastName); user.setEmail(email); idmIdentityService.saveUser(user); return user; }
Example 5
Source File: Sample15RestApplication.java From flowable-engine with Apache License 2.0 | 5 votes |
@Bean public CommandLineRunner usersAndGroupsInitializer(final IdentityService identityService) { return args -> { // install groups & users Group group = identityService.newGroup("user"); group.setName("users"); group.setType("security-role"); identityService.saveGroup(group); User joram = identityService.newUser("jbarrez"); joram.setFirstName("Joram"); joram.setLastName("Barrez"); joram.setPassword("password"); identityService.saveUser(joram); User filip = identityService.newUser("filiphr"); filip.setFirstName("Filip"); filip.setLastName("Hrisafov"); filip.setPassword("password"); identityService.saveUser(filip); User josh = identityService.newUser("jlong"); josh.setFirstName("Josh"); josh.setLastName("Long"); josh.setPassword("password"); identityService.saveUser(josh); identityService.createMembership("jbarrez", "user"); identityService.createMembership("filiphr", "user"); identityService.createMembership("jlong", "user"); }; }
Example 6
Source File: UserResource.java From flowable-engine with Apache License 2.0 | 5 votes |
@ApiOperation(value = "Update a user", tags = { "Users" }, notes = "All request values are optional. " + "For example, you can only include the firstName attribute in the request body JSON-object, only updating the firstName of the user, leaving all other fields unaffected. " + "When an attribute is explicitly included and is set to null, the user-value will be updated to null. " + "Example: {\"firstName\" : null} will clear the firstName of the user).") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the user was updated."), @ApiResponse(code = 404, message = "Indicates the requested user was not found."), @ApiResponse(code = 409, message = "Indicates the requested user was updated simultaneously.") }) @PutMapping(value = "/users/{userId}", produces = "application/json") public UserResponse updateUser(@ApiParam(name = "userId") @PathVariable String userId, @RequestBody UserRequest userRequest, HttpServletRequest request) { User user = getUserFromRequest(userId); if (userRequest.isEmailChanged()) { user.setEmail(userRequest.getEmail()); } if (userRequest.isFirstNameChanged()) { user.setFirstName(userRequest.getFirstName()); } if (userRequest.isLastNameChanged()) { user.setLastName(userRequest.getLastName()); } if (userRequest.isDisplayNameChanged()) { user.setDisplayName(userRequest.getDisplayName()); } if (userRequest.isPasswordChanged()) { user.setPassword(userRequest.getPassword()); identityService.updateUserPassword(user); } else { identityService.saveUser(user); } return restResponseFactory.createUserResponse(user, false); }
Example 7
Source File: SerializableVariablesDisabledTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Before public void setupServer() { if (serverUrlPrefix == null) { TestServer testServer = TestServerUtil.createAndStartServer(ObjectVariableSerializationDisabledApplicationConfiguration.class); serverUrlPrefix = testServer.getServerUrlPrefix(); this.repositoryService = testServer.getApplicationContext().getBean(CmmnRepositoryService.class); this.runtimeService = testServer.getApplicationContext().getBean(CmmnRuntimeService.class); this.identityService = testServer.getApplicationContext().getBean(IdmIdentityService.class); this.taskService = testServer.getApplicationContext().getBean(CmmnTaskService.class); User user = identityService.newUser("kermit"); user.setFirstName("Kermit"); user.setLastName("the Frog"); user.setPassword("kermit"); identityService.saveUser(user); Group group = identityService.newGroup("admin"); group.setName("Administrators"); identityService.saveGroup(group); identityService.createMembership(user.getId(), group.getId()); this.testUserId = user.getId(); this.testGroupId = group.getId(); } }
Example 8
Source File: UserInfoResourceTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Test public void testCreateUserInfo() throws Exception { User savedUser = null; try { User newUser = identityService.newUser("testuser"); newUser.setFirstName("Fred"); newUser.setLastName("McDonald"); newUser.setEmail("[email protected]"); identityService.saveUser(newUser); savedUser = newUser; ObjectNode requestNode = objectMapper.createObjectNode(); requestNode.put("value", "Value 1"); requestNode.put("key", "key1"); HttpPost httpPost = new HttpPost(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_INFO_COLLECTION, "testuser")); httpPost.setEntity(new StringEntity(requestNode.toString())); CloseableHttpResponse response = executeRequest(httpPost, HttpStatus.SC_CREATED); JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent()); closeResponse(response); assertThatJson(responseNode) .isEqualTo("{" + "key: 'key1'," + "value: 'Value 1'," + "url: '" + SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_INFO, newUser.getId(), "key1") + "'" + "}"); } finally { // Delete user after test passes or fails if (savedUser != null) { identityService.deleteUser(savedUser.getId()); } } }
Example 9
Source File: UserResourceTest.java From flowable-engine with Apache License 2.0 | 5 votes |
/** * Test getting a single user. */ @Test public void testGetUser() throws Exception { User savedUser = null; try { User newUser = identityService.newUser("testuser"); newUser.setFirstName("Fred"); newUser.setLastName("McDonald"); newUser.setDisplayName("Fred McDonald"); newUser.setEmail("[email protected]"); identityService.saveUser(newUser); savedUser = newUser; CloseableHttpResponse response = executeRequest( new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER, newUser.getId())), HttpStatus.SC_OK); JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent()); closeResponse(response); assertThat(responseNode).isNotNull(); assertThatJson(responseNode) .when(Option.IGNORING_EXTRA_FIELDS) .isEqualTo("{" + "id: 'testuser'," + "firstName: 'Fred'," + "lastName: 'McDonald'," + "displayName: 'Fred McDonald'," + "email: '[email protected]'," + "url: '" + SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER, newUser.getId()) + "'" + "}"); } finally { // Delete user after test passes or fails if (savedUser != null) { identityService.deleteUser(savedUser.getId()); } } }
Example 10
Source File: ProfileServiceImpl.java From flowable-engine with Apache License 2.0 | 5 votes |
public User updateProfile(String firstName, String lastName, String email) { User currentUser = SecurityUtils.getCurrentUserObject(); // If user is not externally managed, we need the email address for login, so an empty email is not allowed if (StringUtils.isEmpty(email)) { throw new BadRequestException("Empty email is not allowed"); } User user = identityService.createUserQuery().userId(currentUser.getId()).singleResult(); user.setFirstName(firstName); user.setLastName(lastName); user.setEmail(email); identityService.saveUser(user); return user; }
Example 11
Source File: UserInfoResourceTest.java From flowable-engine with Apache License 2.0 | 5 votes |
/** * Test deleting the info for a user who does not have that info set */ @Test public void testUpdateUnexistingInfo() throws Exception { User savedUser = null; try { User newUser = identityService.newUser("testuser"); newUser.setFirstName("Fred"); newUser.setLastName("McDonald"); newUser.setEmail("[email protected]"); identityService.saveUser(newUser); savedUser = newUser; ObjectNode requestNode = objectMapper.createObjectNode(); requestNode.put("value", "Updated value"); HttpPut httpPut = new HttpPut(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_INFO, "testuser", "key1")); httpPut.setEntity(new StringEntity(requestNode.toString())); closeResponse(executeRequest(httpPut, HttpStatus.SC_NOT_FOUND)); } finally { // Delete user after test passes or fails if (savedUser != null) { identityService.deleteUser(savedUser.getId()); } } }
Example 12
Source File: UserCollectionResource.java From flowable-engine with Apache License 2.0 | 5 votes |
@ApiOperation(value = "Create a user", tags = { "Users" }) @ApiResponses(value = { @ApiResponse(code = 201, message = "Indicates the user was created."), @ApiResponse(code = 400, message = "Indicates the id of the user was missing.") }) @PostMapping(value = "/identity/users", produces = "application/json") public UserResponse createUser(@RequestBody UserRequest userRequest, HttpServletRequest request, HttpServletResponse response) { if (userRequest.getId() == null) { throw new FlowableIllegalArgumentException("Id cannot be null."); } if (restApiInterceptor != null) { restApiInterceptor.createUser(userRequest); } // Check if a user with the given ID already exists so we return a CONFLICT if (identityService.createUserQuery().userId(userRequest.getId()).count() > 0) { throw new FlowableConflictException("A user with id '" + userRequest.getId() + "' already exists."); } User created = identityService.newUser(userRequest.getId()); created.setEmail(userRequest.getEmail()); created.setFirstName(userRequest.getFirstName()); created.setLastName(userRequest.getLastName()); created.setDisplayName(userRequest.getDisplayName()); created.setPassword(userRequest.getPassword()); created.setTenantId(userRequest.getTenantId()); identityService.saveUser(created); response.setStatus(HttpStatus.CREATED.value()); return restResponseFactory.createUserResponse(created, true); }
Example 13
Source File: UserPictureResourceTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Test public void testUpdatePictureWithCustomMimeType() throws Exception { User savedUser = null; try { User newUser = identityService.newUser("testuser"); newUser.setFirstName("Fred"); newUser.setLastName("McDonald"); newUser.setEmail("[email protected]"); identityService.saveUser(newUser); savedUser = newUser; Map<String, String> additionalFields = new HashMap<>(); additionalFields.put("mimeType", MediaType.IMAGE_PNG.toString()); HttpPut httpPut = new HttpPut(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_PICTURE, newUser.getId())); httpPut.setEntity(HttpMultipartHelper .getMultiPartEntity("myPicture.png", "image/png", new ByteArrayInputStream("this is the picture raw byte stream".getBytes()), additionalFields)); closeResponse(executeBinaryRequest(httpPut, HttpStatus.SC_NO_CONTENT)); Picture picture = identityService.getUserPicture(newUser.getId()); assertThat(picture).isNotNull(); assertThat(picture.getMimeType()).isEqualTo("image/png"); assertThat(new String(picture.getBytes())).isEqualTo("this is the picture raw byte stream"); } finally { // Delete user after test passes or fails if (savedUser != null) { identityService.deleteUser(savedUser.getId()); } } }
Example 14
Source File: SerializableVariablesDiabledTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Before public void setupServer() { if (serverUrlPrefix == null) { TestServer testServer = TestServerUtil.createAndStartServer(ObjectVariableSerializationDisabledApplicationConfiguration.class); serverUrlPrefix = testServer.getServerUrlPrefix(); this.repositoryService = testServer.getApplicationContext().getBean(RepositoryService.class); this.runtimeService = testServer.getApplicationContext().getBean(RuntimeService.class); this.identityService = testServer.getApplicationContext().getBean(IdentityService.class); this.taskService = testServer.getApplicationContext().getBean(TaskService.class); User user = identityService.newUser("kermit"); user.setFirstName("Kermit"); user.setLastName("the Frog"); user.setPassword("kermit"); identityService.saveUser(user); Group group = identityService.newGroup("admin"); group.setName("Administrators"); identityService.saveGroup(group); identityService.createMembership(user.getId(), group.getId()); this.testUserId = user.getId(); this.testGroupId = group.getId(); } }
Example 15
Source File: UserCollectionResource.java From flowable-engine with Apache License 2.0 | 5 votes |
@ApiOperation(value = "Create a user", tags = { "Users" }) @ApiResponses(value = { @ApiResponse(code = 201, message = "Indicates the user was created."), @ApiResponse(code = 400, message = "Indicates the id of the user was missing.") }) @PostMapping(value = "/users", produces = "application/json") public UserResponse createUser(@RequestBody UserRequest userRequest, HttpServletRequest request, HttpServletResponse response) { if (userRequest.getId() == null) { throw new FlowableIllegalArgumentException("Id cannot be null."); } // Check if a user with the given ID already exists so we return a CONFLICT if (identityService.createUserQuery().userId(userRequest.getId()).count() > 0) { throw new FlowableConflictException("A user with id '" + userRequest.getId() + "' already exists."); } User created = identityService.newUser(userRequest.getId()); created.setEmail(userRequest.getEmail()); created.setFirstName(userRequest.getFirstName()); created.setLastName(userRequest.getLastName()); created.setDisplayName(userRequest.getDisplayName()); created.setPassword(userRequest.getPassword()); if (restApiInterceptor != null) { restApiInterceptor.createNewUser(created); } identityService.saveUser(created); response.setStatus(HttpStatus.CREATED.value()); return idmRestResponseFactory.createUserResponse(created, false); }
Example 16
Source File: UserResourceTest.java From flowable-engine with Apache License 2.0 | 4 votes |
/** * Test updating a single user passing in no fields in the json, user should remain unchanged. */ @Test public void testUpdateUserNullFields() throws Exception { User savedUser = null; try { User newUser = identityService.newUser("testuser"); newUser.setFirstName("Fred"); newUser.setLastName("McDonald"); newUser.setDisplayName("Fred McDonald"); newUser.setEmail("[email protected]"); identityService.saveUser(newUser); savedUser = newUser; ObjectNode taskUpdateRequest = objectMapper.createObjectNode(); taskUpdateRequest.putNull("firstName"); taskUpdateRequest.putNull("lastName"); taskUpdateRequest.putNull("displayName"); taskUpdateRequest.putNull("email"); taskUpdateRequest.putNull("password"); HttpPut httpPut = new HttpPut(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER, newUser.getId())); httpPut.setEntity(new StringEntity(taskUpdateRequest.toString())); CloseableHttpResponse response = executeRequest(httpPut, HttpStatus.SC_OK); JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent()); closeResponse(response); assertThat(responseNode).isNotNull(); assertThatJson(responseNode) .when(Option.IGNORING_EXTRA_FIELDS) .isEqualTo("{" + "id: 'testuser'," + "firstName: null," + "lastName: null," + "displayName: null," + "email: null," + "url: '" + SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER, newUser.getId()) + "'" + "}"); // Check user is updated in Flowable newUser = identityService.createUserQuery().userId(newUser.getId()).singleResult(); assertThat(newUser.getLastName()).isNull(); assertThat(newUser.getFirstName()).isNull(); assertThat(newUser.getDisplayName()).isNull(); assertThat(newUser.getEmail()).isNull(); } finally { // Delete user after test fails if (savedUser != null) { identityService.deleteUser(savedUser.getId()); } } }
Example 17
Source File: UserResourceTest.java From flowable-engine with Apache License 2.0 | 4 votes |
/** * Test updating a single user. */ @Test public void testUpdateUser() throws Exception { User savedUser = null; try { User newUser = identityService.newUser("testuser"); newUser.setFirstName("Fred"); newUser.setLastName("McDonald"); newUser.setEmail("[email protected]"); identityService.saveUser(newUser); savedUser = newUser; ObjectNode taskUpdateRequest = objectMapper.createObjectNode(); taskUpdateRequest.put("firstName", "Tijs"); taskUpdateRequest.put("lastName", "Barrez"); taskUpdateRequest.put("displayName", "Tijs Barrez"); taskUpdateRequest.put("email", "[email protected]"); taskUpdateRequest.put("password", "updatedpassword"); HttpPut httpPut = new HttpPut(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER, newUser.getId())); httpPut.setEntity(new StringEntity(taskUpdateRequest.toString())); CloseableHttpResponse response = executeRequest(httpPut, HttpStatus.SC_OK); JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent()); closeResponse(response); assertThat(responseNode).isNotNull(); assertThatJson(responseNode) .when(Option.IGNORING_EXTRA_FIELDS) .isEqualTo("{" + "id: 'testuser'," + "firstName: 'Tijs'," + "lastName: 'Barrez'," + "displayName: 'Tijs Barrez'," + "email: '[email protected]'," + "url: '" + SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER, newUser.getId()) + "'" + "}"); // Check user is updated in Flowable newUser = identityService.createUserQuery().userId(newUser.getId()).singleResult(); assertThat(newUser.getLastName()).isEqualTo("Barrez"); assertThat(newUser.getFirstName()).isEqualTo("Tijs"); assertThat(newUser.getDisplayName()).isEqualTo("Tijs Barrez"); assertThat(newUser.getEmail()).isEqualTo("[email protected]"); assertThat(newUser.getPassword()).isEqualTo("updatedpassword"); } finally { // Delete user after test fails if (savedUser != null) { identityService.deleteUser(savedUser.getId()); } } }
Example 18
Source File: IdentityServiceTest.java From flowable-engine with Apache License 2.0 | 4 votes |
@Test public void testUpdateUserDeltaOnly() { // First, create a new user User user = idmIdentityService.newUser("testuser"); user.setFirstName("John"); user.setLastName("Doe"); user.setDisplayName("John Doe"); user.setEmail("[email protected]"); user.setPassword("test"); idmIdentityService.saveUser(user); String initialPassword = user.getPassword(); // Fetch and update the user user = idmIdentityService.createUserQuery().userId("testuser").singleResult(); assertThat(user) .returns("John", User::getFirstName) .returns("Doe", User::getLastName) .returns("John Doe", User::getDisplayName) .returns("[email protected]", User::getEmail) .returns(initialPassword, User::getPassword); user.setFirstName("Jane"); idmIdentityService.saveUser(user); user = idmIdentityService.createUserQuery().userId("testuser").singleResult(); assertThat(user) .returns("Jane", User::getFirstName) .returns("Doe", User::getLastName) .returns("John Doe", User::getDisplayName) .returns("[email protected]", User::getEmail) .returns(initialPassword, User::getPassword); user.setLastName("Doelle"); idmIdentityService.saveUser(user); user = idmIdentityService.createUserQuery().userId("testuser").singleResult(); assertThat(user) .returns("Jane", User::getFirstName) .returns("Doelle", User::getLastName) .returns("John Doe", User::getDisplayName) .returns("[email protected]", User::getEmail) .returns(initialPassword, User::getPassword); user.setDisplayName("Jane Doelle"); idmIdentityService.saveUser(user); user = idmIdentityService.createUserQuery().userId("testuser").singleResult(); assertThat(user) .returns("Jane", User::getFirstName) .returns("Doelle", User::getLastName) .returns("Jane Doelle", User::getDisplayName) .returns("[email protected]", User::getEmail) .returns(initialPassword, User::getPassword); user.setEmail("[email protected]"); idmIdentityService.saveUser(user); user = idmIdentityService.createUserQuery().userId("testuser").singleResult(); assertThat(user) .returns("Jane", User::getFirstName) .returns("Doelle", User::getLastName) .returns("Jane Doelle", User::getDisplayName) .returns("[email protected]", User::getEmail) .returns(initialPassword, User::getPassword); user.setPassword("test-pass"); idmIdentityService.saveUser(user); user = idmIdentityService.createUserQuery().userId("testuser").singleResult(); assertThat(user) .returns("Jane", User::getFirstName) .returns("Doelle", User::getLastName) .returns("Jane Doelle", User::getDisplayName) .returns("[email protected]", User::getEmail) .returns(initialPassword, User::getPassword); idmIdentityService.deleteUser(user.getId()); }
Example 19
Source File: Application.java From flowable-engine with Apache License 2.0 | 4 votes |
@Bean CommandLineRunner seedUsersAndGroups(final IdmIdentityService identityService) { return new CommandLineRunner() { @Override public void run(String... strings) throws Exception { // install groups & users Group adminGroup = identityService.newGroup("admin"); adminGroup.setName("admin"); adminGroup.setType("security-role"); identityService.saveGroup(adminGroup); Group group = identityService.newGroup("user"); group.setName("users"); group.setType("security-role"); identityService.saveGroup(group); Privilege userPrivilege = identityService.createPrivilege("user-privilege"); identityService.addGroupPrivilegeMapping(userPrivilege.getId(), group.getId()); Privilege adminPrivilege = identityService.createPrivilege("admin-privilege"); User joram = identityService.newUser("jbarrez"); joram.setFirstName("Joram"); joram.setLastName("Barrez"); joram.setPassword("password"); identityService.saveUser(joram); identityService.addUserPrivilegeMapping(adminPrivilege.getId(), joram.getId()); User filip = identityService.newUser("filiphr"); filip.setFirstName("Filip"); filip.setLastName("Hrisafov"); filip.setPassword("password"); identityService.saveUser(filip); User josh = identityService.newUser("jlong"); josh.setFirstName("Josh"); josh.setLastName("Long"); josh.setPassword("password"); identityService.saveUser(josh); identityService.createMembership("jbarrez", "user"); identityService.createMembership("jbarrez", "admin"); identityService.createMembership("filiphr", "user"); identityService.createMembership("jlong", "user"); } }; }
Example 20
Source File: FlowableUserDetailsServiceTest.java From flowable-engine with Apache License 2.0 | 4 votes |
@Test public void testLoadingKnownUserWithAllPrivileges() { UserDetails kermit = userDetailsService.loadUserByUsername("kermit"); assertThat(kermit).isNotNull(); assertThat(kermit.isCredentialsNonExpired()).as("credentialsNonExpired").isTrue(); assertThat(kermit.isAccountNonLocked()).as("accountNonLocked").isTrue(); assertThat(kermit.isAccountNonExpired()).as("accountNonExpired").isTrue(); assertThat(kermit.isEnabled()).as("enabled").isTrue(); assertThat(kermit.getUsername()).as("username").isEqualTo("kermit"); assertThat(kermit.getPassword()).as("password").isEqualTo("kermit"); assertThat(kermit.getAuthorities()) .extracting(GrantedAuthority::getAuthority) .as("granted authorities") .containsExactly( "access admin application", "access modeler application", "start processes" ); assertThat(kermit).isInstanceOf(FlowableUserDetails.class); FlowableUserDetails kermitFlowable = (FlowableUserDetails) kermit; User user = kermitFlowable.getUser(); assertThat(user.getId()).isEqualTo("kermit"); assertThat(user.getFirstName()).isEqualTo("Kermit"); assertThat(user.getLastName()).isEqualTo("the Frog"); assertThat(user.getDisplayName()).isEqualTo("Kermit the Frog"); assertThat(user.getEmail()).isEqualTo("[email protected]"); assertThat(user.getPassword()).isEqualTo("kermit"); user.setId("test"); user.setFirstName("test"); user.setLastName("test"); user.setDisplayName("test"); user.setEmail("test"); assertThat(user.getId()).isEqualTo("kermit"); assertThat(user.getFirstName()).isEqualTo("Kermit"); assertThat(user.getLastName()).isEqualTo("the Frog"); assertThat(user.getDisplayName()).isEqualTo("Kermit the Frog"); assertThat(user.getEmail()).isEqualTo("[email protected]"); assertThat(kermitFlowable.getGroups()) .extracting(Group::getId, Group::getName, Group::getType) .as("Groups") .containsExactlyInAnyOrder( tuple("admins", "Admins", "user"), tuple("sales", "Sales", "user"), tuple("engineering", "Engineering", "tech") ); kermitFlowable.getGroups().forEach(group -> { group.setId("test"); group.setType("test"); group.setName("test"); }); assertThat(kermitFlowable.getGroups()) .extracting(Group::getId, Group::getName, Group::getType) .as("Groups") .containsExactlyInAnyOrder( tuple("admins", "Admins", "user"), tuple("sales", "Sales", "user"), tuple("engineering", "Engineering", "tech") ); assertThat(kermit).isInstanceOf(CredentialsContainer.class); CredentialsContainer container = (CredentialsContainer) kermit; container.eraseCredentials(); assertThat(kermit.getPassword()).as("Password after erase").isNull(); assertThat(kermitFlowable.getUser().getPassword()).as("User password after erase").isNull(); }