Search in sources :

Example 1 with Entry

use of com.unboundid.scim.data.Entry in project cas by apereo.

the class Scim1PrincipalAttributeMapper 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);
    user.setNickName(getPrincipalAttributeValue(p, "nickName"));
    user.setDisplayName(getPrincipalAttributeValue(p, "displayName"));
    final Name name = new Name(getPrincipalAttributeValue(p, "formattedName"), getPrincipalAttributeValue(p, "familyName"), getPrincipalAttributeValue(p, "middleName"), getPrincipalAttributeValue(p, "givenName"), getPrincipalAttributeValue(p, "honorificPrefix"), getPrincipalAttributeValue(p, "honorificSuffix"));
    user.setName(name);
    Entry entry = new Entry(getPrincipalAttributeValue(p, "mail"), "primary");
    user.setEmails(CollectionUtils.wrap(entry));
    entry = new Entry(getPrincipalAttributeValue(p, "phoneNumber"), "primary");
    user.setPhoneNumbers(CollectionUtils.wrap(entry));
}
Also used : Entry(com.unboundid.scim.data.Entry) Name(com.unboundid.scim.data.Name)

Example 2 with Entry

use of com.unboundid.scim.data.Entry in project cas by apereo.

the class ScimV1PrincipalAttributeMapper 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 Credential credential) {
    user.setUserName(p.getId());
    if (credential instanceof UsernamePasswordCredential) {
        user.setPassword(UsernamePasswordCredential.class.cast(credential).getPassword());
    }
    user.setActive(Boolean.TRUE);
    user.setNickName(getPrincipalAttributeValue(p, "nickName"));
    user.setDisplayName(getPrincipalAttributeValue(p, "displayName"));
    val name = new Name(getPrincipalAttributeValue(p, "formattedName"), getPrincipalAttributeValue(p, "familyName"), getPrincipalAttributeValue(p, "middleName"), getPrincipalAttributeValue(p, "givenName"), getPrincipalAttributeValue(p, "honorificPrefix"), getPrincipalAttributeValue(p, "honorificSuffix"));
    user.setName(name);
    val entry = new Entry(getPrincipalAttributeValue(p, "mail"), "primary");
    user.setEmails(CollectionUtils.wrap(entry));
    val entry2 = new Entry(getPrincipalAttributeValue(p, "phoneNumber"), "primary");
    user.setPhoneNumbers(CollectionUtils.wrap(entry2));
}
Also used : lombok.val(lombok.val) Entry(com.unboundid.scim.data.Entry) UsernamePasswordCredential(org.apereo.cas.authentication.credential.UsernamePasswordCredential) Name(com.unboundid.scim.data.Name)

Aggregations

Entry (com.unboundid.scim.data.Entry)2 Name (com.unboundid.scim.data.Name)2 lombok.val (lombok.val)1 UsernamePasswordCredential (org.apereo.cas.authentication.credential.UsernamePasswordCredential)1