use of com.google.api.ads.admanager.axis.v202111.User in project camel by apache.
the class UserProducer method doGet.
private void doGet(Exchange exchange) {
final Message msg = exchange.getIn();
final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(KeystoneConstants.USER_ID, String.class), String.class);
ObjectHelper.notEmpty(id, "User ID");
final User result = osV3Client.identity().users().get(id);
msg.setBody(result);
}
use of com.google.api.ads.admanager.axis.v202111.User in project camel by apache.
the class UserProducer method doCreate.
private void doCreate(Exchange exchange) {
final User in = messageToUser(exchange.getIn());
final User out = osV3Client.identity().users().create(in);
exchange.getIn().setBody(out);
}
use of com.google.api.ads.admanager.axis.v202111.User in project oxTrust by GluuFederation.
the class UserCoreLoadingStrategy method createDummyUser.
private User createDummyUser() {
User user = new User();
org.gluu.oxtrust.model.scim2.Name name = new org.gluu.oxtrust.model.scim2.Name();
name.setGivenName("");
name.setMiddleName("");
name.setFamilyName("");
name.setHonorificPrefix("");
name.setHonorificSuffix("");
user.setName(name);
user.setActive(false);
user.setId("");
user.setExternalId("");
user.setUserName("");
user.setPassword("");
user.setDisplayName("");
user.setNickName("");
user.setProfileUrl("");
user.setLocale("");
user.setPreferredLanguage("");
user.setTimezone("");
user.setTitle("");
List<GroupRef> groups = new ArrayList<GroupRef>();
GroupRef groupRef = new GroupRef();
groupRef.setOperation("");
groupRef.setPrimary(false);
groupRef.setValue("test");
groupRef.setDisplay("");
groupRef.setType(GroupRef.Type.DIRECT);
groupRef.setReference("");
groups.add(groupRef);
user.setGroups(groups);
List<Email> emails = new ArrayList<Email>();
Email email = new Email();
email.setOperation("");
email.setPrimary(false);
email.setValue("a@b.com");
email.setDisplay("");
email.setType(Email.Type.WORK);
email.setReference("");
emails.add(email);
user.setEmails(emails);
List<PhoneNumber> phoneNumbers = new ArrayList<PhoneNumber>();
PhoneNumber phoneNumber = new PhoneNumber();
phoneNumber.setOperation("");
phoneNumber.setPrimary(false);
phoneNumber.setValue("123-456-7890");
phoneNumber.setDisplay("");
phoneNumber.setType(PhoneNumber.Type.WORK);
phoneNumber.setReference("");
phoneNumbers.add(phoneNumber);
user.setPhoneNumbers(phoneNumbers);
List<Im> ims = new ArrayList<Im>();
Im im = new Im();
im.setOperation("");
im.setPrimary(false);
im.setValue("test");
im.setDisplay("");
im.setType(Im.Type.SKYPE);
im.setReference("");
ims.add(im);
user.setIms(ims);
List<Photo> photos = new ArrayList<Photo>();
Photo photo = new Photo();
photo.setOperation("");
photo.setPrimary(false);
photo.setValue("data:image/jpg;charset=utf-8;base64,dGVzdA==");
photo.setDisplay("");
photo.setType(Photo.Type.PHOTO);
photo.setReference("");
photos.add(photo);
user.setPhotos(photos);
List<Address> addresses = new ArrayList<Address>();
Address address = new Address();
address.setOperation("");
address.setPrimary(false);
address.setValue("test");
address.setDisplay("");
address.setType(Address.Type.WORK);
address.setReference("");
address.setStreetAddress("");
address.setLocality("");
address.setPostalCode("");
address.setRegion("");
address.setCountry("");
address.setFormatted("");
addresses.add(address);
user.setAddresses(addresses);
List<Entitlement> entitlements = new ArrayList<Entitlement>();
Entitlement entitlement = new Entitlement();
entitlement.setOperation("");
entitlement.setPrimary(false);
entitlement.setValue("test");
entitlement.setDisplay("");
entitlement.setType(new Entitlement.Type("test"));
entitlement.setReference("");
entitlements.add(entitlement);
user.setEntitlements(entitlements);
List<Role> roles = new ArrayList<Role>();
Role role = new Role();
role.setOperation("");
role.setPrimary(false);
role.setValue("test");
role.setDisplay("");
role.setType(new Role.Type("test"));
role.setReference("");
roles.add(role);
user.setRoles(roles);
List<X509Certificate> x509Certificates = new ArrayList<X509Certificate>();
X509Certificate x509Certificate = new X509Certificate();
x509Certificate.setOperation("");
x509Certificate.setPrimary(false);
x509Certificate.setValue("test");
x509Certificate.setDisplay("");
x509Certificate.setType(new X509Certificate.Type("test"));
x509Certificate.setReference("");
x509Certificates.add(x509Certificate);
user.setX509Certificates(x509Certificates);
return user;
}
use of com.google.api.ads.admanager.axis.v202111.User in project oxTrust by GluuFederation.
the class Scim2UserService method createUser.
public User createUser(User user) throws Exception {
log.debug(" copying gluuperson ");
GluuCustomPerson gluuPerson = copyUtils2.copy(user, null, false);
if (gluuPerson == null) {
throw new Exception("Scim2UserService.createUser(): Failed to create user; GluuCustomPerson is null");
}
log.debug(" generating inum ");
// inumService.generateInums(Configuration.INUM_TYPE_PEOPLE_SLUG);
String inum = personService.generateInumForNewPerson();
// //personService.generateInumForNewPerson();
log.debug(" getting DN ");
String dn = personService.getDnForPerson(inum);
log.debug(" getting iname ");
String iname = personService.generateInameForNewPerson(user.getUserName());
log.debug(" setting dn ");
gluuPerson.setDn(dn);
log.debug(" setting inum ");
gluuPerson.setInum(inum);
log.debug(" setting iname ");
gluuPerson.setIname(iname);
log.debug(" setting commonName ");
gluuPerson.setCommonName(gluuPerson.getGivenName() + " " + gluuPerson.getSurname());
log.info("gluuPerson.getMemberOf().size() : " + gluuPerson.getMemberOf().size());
if (user.getGroups().size() > 0) {
log.info(" jumping to groupMembersAdder ");
log.info("gluuPerson.getDn() : " + gluuPerson.getDn());
serviceUtil.groupMembersAdder(gluuPerson, gluuPerson.getDn());
}
// As per spec, the SP must be the one to assign the meta attributes
log.info(" Setting meta: create user ");
// Date should be in UTC format
DateTimeFormatter dateTimeFormatter = ISODateTimeFormat.dateTime().withZoneUTC();
Date dateCreated = DateTime.now().toDate();
String relativeLocation = "/scim/v2/Users/" + inum;
gluuPerson.setAttribute("oxTrustMetaCreated", dateTimeFormatter.print(dateCreated.getTime()));
gluuPerson.setAttribute("oxTrustMetaLastModified", dateTimeFormatter.print(dateCreated.getTime()));
gluuPerson.setAttribute("oxTrustMetaLocation", relativeLocation);
// Sync email, forward ("oxTrustEmail" -> "mail")
gluuPerson = serviceUtil.syncEmailForward(gluuPerson, true);
// For custom script: create user
if (externalScimService.isEnabled()) {
externalScimService.executeScimCreateUserMethods(gluuPerson);
}
log.debug("adding new GluuPerson");
personService.addPerson(gluuPerson);
User createdUser = copyUtils2.copy(gluuPerson, null);
return createdUser;
}
use of com.google.api.ads.admanager.axis.v202111.User in project oxTrust by GluuFederation.
the class Scim2UserService method addUserPatch.
private void addUserPatch(Operation operation, String id) throws Exception {
User user = operation.getValue();
GluuCustomPerson updatedGluuPerson = patchUtil.addPatch(user, validUsernameByInum(user, id));
log.info(" Setting meta: addUserPatch update user ");
setMeta(updatedGluuPerson);
}
Aggregations