当前位置: 首页>>代码示例>>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;未经允许,请勿转载。