Product SiteDocumentation Site

⁠5.2. Managing Users, Groups and Roles

PicketLink IDM provides a number of basic implementations of the identity model interfaces for convenience, in the org.picketlink.idm.model.basic package. The following sections provide examples that show these implementations in action.

⁠5.2.1. Managing Users

The following code example demonstrates how to create a new user with the following properties:
  • Login name - jsmith
  • First name - John
  • Last name - Smith
  • E-mail - jsmith@acme.com
​  User user = new User("jsmith");
​  user.setFirstName("John");
​  user.setLastName("Smith");
​  user.setEmail("jsmith@acme.com");
​  identityManager.add(user);
Once the User is created, it's possible to look it up using its login name:
​  User user = BasicModel.getUser(identityManager, "jsmith");
User properties can also be modified after the User has already been created. The following example demonstrates how to change the e-mail address of the user we created above:
​  User user = BasicModel.getUser(identityManager, "jsmith");
​  user.setEmail("john@smith.com");
​  identityManager.update(user);
Users may also be deleted. The following example demonstrates how to delete the user previously created:
​  User user = BasicModel.getUser(identityManager, "jsmith");
​  identityManager.remove("jsmith");