本文整理汇总了Java中org.cloudfoundry.identity.uaa.scim.ScimUser.Email方法的典型用法代码示例。如果您正苦于以下问题:Java ScimUser.Email方法的具体用法?Java ScimUser.Email怎么用?Java ScimUser.Email使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cloudfoundry.identity.uaa.scim.ScimUser
的用法示例。
在下文中一共展示了ScimUser.Email方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newUser
import org.cloudfoundry.identity.uaa.scim.ScimUser; //导入方法依赖的package包/类
public static ScimUser newUser(String username, String password) {
ScimUser scimUser = new ScimUser();
scimUser.setUserName(username);
ScimUser.Email email = new ScimUser.Email();
email.setPrimary(true);
email.setValue(username);
scimUser.setEmails(Arrays.asList(email));
scimUser.setOrigin(Origin.UAA);
scimUser.setPassword(password);
scimUser.setVerified(true);
return scimUser;
}
示例2: activateUser
import org.cloudfoundry.identity.uaa.scim.ScimUser; //导入方法依赖的package包/类
@Override
public UserActivationResponseDto activateUser(UserActivationRequestDto userActivationRequest, String xForwardedProto, String xForwardedHost, int xForwardedPort) {
// Verify password
assertPasswordAndConfirmPassword(userActivationRequest);
// Find user creation process with emailToken and verificationCode
final UserCreation userCreation = userCreationRepository.findOneByEmailTokenAndVerificationCode(
userActivationRequest.getEmailToken(),
userActivationRequest.getVerificationCode())
.orElseThrow(UserActivationCannotBeVerifiedException::new);
// Assert user creation process preconditions
assertNotAlreadyVerified(userCreation);
assertEmailTokenNotExpired(userCreation);
// Find patient profile on PHR
final PatientDto patientProfile = phrService.findPatientProfileById(userCreation.getPatientId(), true);
// Assert username and patient email match
assertUsernameAndPatientEmailMatch(userActivationRequest, patientProfile);
// Assert birth date verification
assertBirthDateVerification(userActivationRequest, patientProfile);
userCreation.setVerified(true);
userCreationRepository.save(userCreation);
// Prepare response
final UserActivationResponseDto response = modelMapper.map(patientProfile, UserActivationResponseDto.class);
response.setBirthDate(patientProfile.getBirthDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
response.setVerified(userCreation.isVerified());
// Create user using SCIM
ScimUser scimUser = new ScimUser(null, patientProfile.getEmail(), patientProfile.getFirstName(), patientProfile.getLastName());
scimUser.setPassword(userActivationRequest.getPassword());
ScimUser.Email email = new ScimUser.Email();
email.setValue(patientProfile.getEmail());
scimUser.setEmails(Collections.singletonList(email));
scimUser.setVerified(true);
// Save SCIM user
final ScimUser savedScimUser = scimService.save(scimUser);
final String userId = savedScimUser.getId();
Assert.hasText(userId, "SCIM userId must have text");
// Save userId in userCreation
userCreation.setUserId(userId);
userCreationRepository.save(userCreation);
// Add user to groups
scimService.addUserToGroups(userCreation);
emailSender.sendEmailToConfirmVerification(
xForwardedProto, xForwardedHost, xForwardedPort,
patientProfile.getEmail(),
getRecipientFullName(patientProfile));
return response;
}