本文整理匯總了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;
}