当前位置: 首页>>代码示例>>Java>>正文


Java User.getPassword方法代码示例

本文整理汇总了Java中org.osiam.resources.scim.User.getPassword方法的典型用法代码示例。如果您正苦于以下问题:Java User.getPassword方法的具体用法?Java User.getPassword怎么用?Java User.getPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.osiam.resources.scim.User的用法示例。


在下文中一共展示了User.getPassword方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: replace

import org.osiam.resources.scim.User; //导入方法依赖的package包/类
@Override
public User replace(String id, User user) {
    UserEntity existingEntity = userDao.getById(id);

    if (userDao.isUserNameAlreadyTaken(user.getUserName(), id)) {
        throw new ResourceExistsException(String.format(
                "Can't replace the user with the id \"%s\". The username \"%s\" is already taken.", id,
                user.getUserName()));
    }
    if (userDao.isExternalIdAlreadyTaken(user.getExternalId(), id)) {
        throw new ResourceExistsException(String.format(
                "Can't replace the user with the id \"%s\". The externalId \"%s\" is already taken.", id,
                user.getExternalId()));
    }

    UserEntity userEntity = userConverter.fromScim(user);

    userEntity.setInternalId(existingEntity.getInternalId());
    userEntity.setMeta(existingEntity.getMeta());
    userEntity.setId(existingEntity.getId());

    if (user.getPassword() != null && !user.getPassword().isEmpty()) {
        String hashedPassword = bCryptPasswordEncoder.encode(user.getPassword());
        userEntity.setPassword(hashedPassword);
    } else {
        userEntity.setPassword(existingEntity.getPassword());
    }

    userEntity.touch();

    userEntity = userDao.update(userEntity);

    return removePassword(userConverter.toScim(userEntity));
}
 
开发者ID:osiam,项目名称:osiam,代码行数:35,代码来源:SCIMUserProvisioning.java

示例2: replace

import org.osiam.resources.scim.User; //导入方法依赖的package包/类
@Override
public User replace(String id, User user) {
    UserEntity existingEntity = userDao.getById(id);

    if (userDao.isUserNameAlreadyTaken(user.getUserName(), id)) {
        throw new ResourceExistsException(String.format(
                "Can't replace the user with the id \"%s\". The username \"%s\" is already taken.", id,
                user.getUserName()));
    }
    if (userDao.isExternalIdAlreadyTaken(user.getExternalId(), id)) {
        throw new ResourceExistsException(String.format(
                "Can't replace the user with the id \"%s\". The externalId \"%s\" is already taken.", id,
                user.getExternalId()));
    }

    UserEntity userEntity = userConverter.fromScim(user);

    userEntity.setInternalId(existingEntity.getInternalId());
    userEntity.setMeta(existingEntity.getMeta());
    userEntity.setId(existingEntity.getId());

    if (user.getPassword() != null && !user.getPassword().isEmpty()) {
        String hashedPassword = passwordEncoder.encodePassword(user.getPassword(), userEntity.getId());
        userEntity.setPassword(hashedPassword);
    } else {
        userEntity.setPassword(existingEntity.getPassword());
    }

    userEntity.touch();

    userEntity = userDao.update(userEntity);

    return getUserWithoutPassword(userConverter.toScim(userEntity));
}
 
开发者ID:osiam,项目名称:resource-server,代码行数:35,代码来源:SCIMUserProvisioning.java

示例3: fromScim

import org.osiam.resources.scim.User; //导入方法依赖的package包/类
@Override
public UserEntity fromScim(User user) {
    if (user == null) {
        return null;
    }
    UserEntity userEntity = new UserEntity();

    if (user.getPassword() != null && !user.getPassword().isEmpty()) {
        userEntity.setPassword(user.getPassword());
    }

    if (user.isActive() != null) {
        userEntity.setActive(user.isActive());
    }

    userEntity.setDisplayName(user.getDisplayName());
    userEntity.setNickName(user.getNickName());
    userEntity.setExternalId(user.getExternalId() == null ? null : user.getExternalId().isEmpty() ? null : user
            .getExternalId()); // Due to uniqueness in databases
    userEntity.setPreferredLanguage(user.getPreferredLanguage());
    userEntity.setLocale(user.getLocale());
    userEntity.setProfileUrl(user.getProfileUrl());
    userEntity.setTimezone(user.getTimezone());
    userEntity.setTitle(user.getTitle());
    userEntity.setUserName(user.getUserName());
    userEntity.setUserType(user.getUserType());

    userEntity.setName(nameConverter.fromScim(user.getName()));

    Set<AddressEntity> addresses = convertMultiValueFromScim(addressConverter, new HashSet<>(user.getAddresses()));
    for (AddressEntity addressEntity : addresses) {
        userEntity.addAddress(addressEntity);
    }

    Set<EmailEntity> emails = convertMultiValueFromScim(emailConverter, new HashSet<>(user.getEmails()));
    for (EmailEntity emailEntity : emails) {
        userEntity.addEmail(emailEntity);
    }

    Set<EntitlementEntity> entitlements = convertMultiValueFromScim(entitlementConverter,
            new HashSet<>(user.getEntitlements()));
    for (EntitlementEntity entitlementEntity : entitlements) {
        userEntity.addEntitlement(entitlementEntity);
    }

    Set<ImEntity> ims = convertMultiValueFromScim(imConverter, new HashSet<>(user.getIms()));
    for (ImEntity imEntity : ims) {
        userEntity.addIm(imEntity);
    }

    Set<PhoneNumberEntity> phoneNumbers = convertMultiValueFromScim(phoneNumberConverter,
            new HashSet<>(user.getPhoneNumbers()));
    for (PhoneNumberEntity phoneNumberEntity : phoneNumbers) {
        userEntity.addPhoneNumber(phoneNumberEntity);
    }

    Set<PhotoEntity> photos = convertMultiValueFromScim(photoConverter, new HashSet<>(user.getPhotos()));
    for (PhotoEntity photoEntity : photos) {
        userEntity.addPhoto(photoEntity);
    }

    Set<RoleEntity> roles = convertMultiValueFromScim(roleConverter, new HashSet<>(user.getRoles()));
    for (RoleEntity roleEntity : roles) {
        userEntity.addRole(roleEntity);
    }

    Set<X509CertificateEntity> x509Certificates = convertMultiValueFromScim(x509CertificateConverter,
            new HashSet<>(user.getX509Certificates()));
    for (X509CertificateEntity x509CertificateEntity : x509Certificates) {
        userEntity.addX509Certificate(x509CertificateEntity);
    }

    Set<ExtensionFieldValueEntity> fieldValues = extensionConverter.fromScim(new HashSet<>(user.getExtensions()
            .values()));
    for (ExtensionFieldValueEntity fieldValue : fieldValues) {
        userEntity.addOrUpdateExtensionValue(fieldValue);
    }

    return userEntity;
}
 
开发者ID:osiam,项目名称:osiam,代码行数:81,代码来源:UserConverter.java

示例4: fromScim

import org.osiam.resources.scim.User; //导入方法依赖的package包/类
@Override
public UserEntity fromScim(User user) {
    if (user == null) {
        return null;
    }
    UserEntity userEntity = new UserEntity();

    if (user.getPassword() != null && !user.getPassword().isEmpty()) {
        userEntity.setPassword(user.getPassword());
    }

    if(user.isActive() != null) {
        userEntity.setActive(user.isActive());
    }

    userEntity.setDisplayName(user.getDisplayName());
    userEntity.setNickName(user.getNickName());
    userEntity.setExternalId(user.getExternalId() == null ? null : user.getExternalId().isEmpty() ? null : user
            .getExternalId()); // Due to uniqueness in databases
    userEntity.setPreferredLanguage(user.getPreferredLanguage());
    userEntity.setLocale(user.getLocale());
    userEntity.setProfileUrl(user.getProfileUrl());
    userEntity.setTimezone(user.getTimezone());
    userEntity.setTitle(user.getTitle());
    userEntity.setUserName(user.getUserName());
    userEntity.setUserType(user.getUserType());

    userEntity.setName(nameConverter.fromScim(user.getName()));

    Set<AddressEntity> addresses = convertMultiValueFromScim(addressConverter, new HashSet<>(user.getAddresses()));
    for (AddressEntity addressEntity : addresses) {
        userEntity.addAddress(addressEntity);
    }

    Set<EmailEntity> emails = convertMultiValueFromScim(emailConverter, new HashSet<>(user.getEmails()));
    for (EmailEntity emailEntity : emails) {
        userEntity.addEmail(emailEntity);
    }

    Set<EntitlementEntity> entitlements = convertMultiValueFromScim(entitlementConverter,
            new HashSet<>(user.getEntitlements()));
    for (EntitlementEntity entitlementEntity : entitlements) {
        userEntity.addEntitlement(entitlementEntity);
    }

    Set<ImEntity> ims = convertMultiValueFromScim(imConverter, new HashSet<>(user.getIms()));
    for (ImEntity imEntity : ims) {
        userEntity.addIm(imEntity);
    }

    Set<PhoneNumberEntity> phoneNumbers = convertMultiValueFromScim(phoneNumberConverter,
            new HashSet<>(user.getPhoneNumbers()));
    for (PhoneNumberEntity phoneNumberEntity : phoneNumbers) {
        userEntity.addPhoneNumber(phoneNumberEntity);
    }

    Set<PhotoEntity> photos = convertMultiValueFromScim(photoConverter, new HashSet<>(user.getPhotos()));
    for (PhotoEntity photoEntity : photos) {
        userEntity.addPhoto(photoEntity);
    }

    Set<RoleEntity> roles = convertMultiValueFromScim(roleConverter, new HashSet<>(user.getRoles()));
    for (RoleEntity roleEntity : roles) {
        userEntity.addRole(roleEntity);
    }

    Set<X509CertificateEntity> x509Certificates = convertMultiValueFromScim(x509CertificateConverter,
            new HashSet<>(user.getX509Certificates()));
    for (X509CertificateEntity x509CertificateEntity : x509Certificates) {
        userEntity.addX509Certificate(x509CertificateEntity);
    }

    Set<ExtensionFieldValueEntity> fieldValues = extensionConverter.fromScim(new HashSet<>(user.getExtensions()
            .values()));
    for (ExtensionFieldValueEntity fieldValue : fieldValues) {
        userEntity.addOrUpdateExtensionValue(fieldValue);
    }

    return userEntity;
}
 
开发者ID:osiam,项目名称:resource-server,代码行数:81,代码来源:UserConverter.java


注:本文中的org.osiam.resources.scim.User.getPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。