use of com.unboundid.scim2.common.types.PhoneNumber in project cas by apereo.
the class Scim2PrincipalAttributeMapper method map.
/**
* Map.
*
* @param user the user
* @param p the p
* @param credential the credential
*/
public void map(final UserResource user, final Principal p, final UsernamePasswordCredential credential) {
user.setUserName(p.getId());
user.setPassword(credential.getPassword());
user.setActive(Boolean.TRUE);
String attr = getPrincipalAttributeValue(p, "nickName");
user.setNickName(attr);
attr = getPrincipalAttributeValue(p, "displayName");
user.setDisplayName(attr);
final Name name = new Name();
attr = getPrincipalAttributeValue(p, "givenName");
name.setGivenName(attr);
attr = getPrincipalAttributeValue(p, "familyName");
name.setFamilyName(attr);
attr = getPrincipalAttributeValue(p, "middleName");
name.setMiddleName(attr);
user.setName(name);
final Email email = new Email();
email.setPrimary(Boolean.TRUE);
attr = getPrincipalAttributeValue(p, "mail");
if (StringUtils.isBlank(attr)) {
attr = getPrincipalAttributeValue(p, "email");
}
email.setValue(attr);
user.setEmails(CollectionUtils.wrap(email));
final PhoneNumber phone = new PhoneNumber();
phone.setPrimary(Boolean.TRUE);
attr = getPrincipalAttributeValue(p, "phone");
if (StringUtils.isBlank(attr)) {
attr = getPrincipalAttributeValue(p, "phoneNumber");
}
phone.setValue(attr);
user.setPhoneNumbers(CollectionUtils.wrap(phone));
}
use of com.unboundid.scim2.common.types.PhoneNumber in project cas by apereo.
the class DefaultScimV2PrincipalAttributeMapper method map.
@Override
public void map(final UserResource user, final Principal principal, final Credential credential) {
user.setUserName(principal.getId());
if (credential instanceof UsernamePasswordCredential) {
user.setPassword(UsernamePasswordCredential.class.cast(credential).getPassword());
}
user.setActive(Boolean.TRUE);
user.setNickName(getPrincipalAttributeValue(principal, "nickName"));
user.setDisplayName(getPrincipalAttributeValue(principal, "displayName"));
val name = new Name();
name.setGivenName(getPrincipalAttributeValue(principal, "givenName"));
name.setFamilyName(getPrincipalAttributeValue(principal, "familyName"));
name.setMiddleName(getPrincipalAttributeValue(principal, "middleName"));
user.setName(name);
val email = new Email();
email.setPrimary(Boolean.TRUE);
email.setValue(getPrincipalAttributeValue(principal, "email"));
user.setEmails(CollectionUtils.wrap(email));
val phone = new PhoneNumber();
phone.setPrimary(Boolean.TRUE);
phone.setValue(getPrincipalAttributeValue(principal, "phoneNumber"));
user.setPhoneNumbers(CollectionUtils.wrap(phone));
user.setExternalId(getPrincipalAttributeValue(principal, "externalId", principal.getId()));
if (user.getMeta() == null) {
val meta = new Meta();
meta.setCreated(Calendar.getInstance(TimeZone.getTimeZone(ZoneOffset.UTC)));
meta.setResourceType(user.getUserType());
user.setMeta(meta);
}
}
Aggregations