256 log.debug(
"transferAttributesToUserResource");
258 res.setId(person.getInum());
259 res.setExternalId(person.getAttribute(
"oxTrustExternalId"));
261 Meta meta=
new Meta();
262 meta.setResourceType(ScimResourceUtil.getType(res.getClass()));
264 meta.setCreated(person.getAttribute(
"oxTrustMetaCreated"));
265 if (meta.getCreated() == null) {
266 Date tmpDate = person.getCreationDate();
267 meta.setCreated(tmpDate == null ? null : ISODateTimeFormat.dateTime().withZoneUTC().print(tmpDate.getTime()));
270 meta.setLastModified(person.getAttribute(
"oxTrustMetaLastModified"));
271 if (meta.getLastModified() == null) {
272 Date tmpDate = person.getUpdatedAt();
273 meta.setLastModified(tmpDate == null ? null : ISODateTimeFormat.dateTime().withZoneUTC().print(tmpDate.getTime()));
276 meta.setLocation(person.getAttribute(
"oxTrustMetaLocation"));
277 if (meta.getLocation()==null)
278 meta.setLocation(url +
"/" + person.getInum());
283 res.setUserName(person.getUid());
285 Name name=
new Name();
286 name.setGivenName(person.getGivenName());
287 name.setFamilyName(person.getSurname());
288 name.setMiddleName(person.getAttribute(
"middleName"));
289 name.setHonorificPrefix(person.getAttribute(
"oxTrusthonorificPrefix"));
290 name.setHonorificSuffix(person.getAttribute(
"oxTrusthonorificSuffix"));
292 String formatted=person.getAttribute(
"oxTrustNameFormatted");
294 name.computeFormattedName();
296 name.setFormatted(formatted);
299 res.setDisplayName(person.getDisplayName());
301 res.setNickName(person.getAttribute(
"nickname"));
302 res.setProfileUrl(person.getAttribute(
"oxTrustProfileURL"));
303 res.setTitle(person.getAttribute(
"oxTrustTitle"));
304 res.setUserType(person.getAttribute(
"oxTrustUserType"));
306 res.setPreferredLanguage(person.getPreferredLanguage());
307 res.setLocale(person.getAttribute(
"locale"));
308 res.setTimezone(person.getTimezone());
310 res.setActive(Boolean.valueOf(person.getAttribute(
"oxTrustActive"))
311 || GluuBoolean.getByValue(person.getAttribute(
"gluuStatus")).isBooleanValue());
312 res.setPassword(person.getUserPassword());
320 List<String> listOfGroups = person.getMemberOf();
321 if (listOfGroups!= null && listOfGroups.size()>0) {
322 List<Group> groupList =
new ArrayList<Group>();
324 for (String groupDN : listOfGroups) {
328 Group group =
new Group();
329 group.setValue(gluuGroup.getInum());
331 group.setRef(reference);
332 group.setDisplay(gluuGroup.getDisplayName());
333 group.setType(Group.Type.DIRECT);
335 groupList.add(group);
338 log.warn(
"transferAttributesToUserResource. Group with dn {} could not be added to User Resource. {}", groupDN, person.getUid());
339 log.error(e.getMessage(), e);
342 if (groupList.size()>0)
343 res.setGroups(groupList);
348 res.setX509Certificates(
getAttributeListValue(person, X509Certificate.class,
"oxTrustx509Certificate"));
350 res.setPairwiseIdentitifers(person.getOxPPID());
Logger log
Definition: Scim2UserService.java:71
abstract GluuGroup getGroupByDn(String Dn)
void transferExtendedAttributesToResource(GluuCustomPerson person, BaseScimResource resource)
Definition: Scim2UserService.java:355
IGroupService groupService
Definition: Scim2UserService.java:83
private< T > List< T > getAttributeListValue(GluuCustomPerson source, Class< T > clazz, String attrName)
Definition: Scim2UserService.java:125
String getEndpointUrl()
Definition: BaseScimWebService.java:71
GroupWebService groupWS
Definition: Scim2UserService.java:86