當前位置: 首頁>>代碼示例>>Java>>正文


Java ScimUser.Email方法代碼示例

本文整理匯總了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;
}
 
開發者ID:trustedanalytics,項目名稱:cf-client,代碼行數:14,代碼來源:ScimUserFactory.java

示例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;
}
 
開發者ID:bhits,項目名稱:patient-user-api,代碼行數:48,代碼來源:UserCreationServiceImpl.java


注:本文中的org.cloudfoundry.identity.uaa.scim.ScimUser.Email方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。