Expand my Community achievements bar.

SOLVED

Create user in aem6.1 programattically

Avatar

Level 4

Hi All,

Is it possible to create users in AEM6.1 by using  Jackrabbit User Manager API within the OSGi bundle. I have just followed below forum URL but the code is throwing some exception.Please provide your suggestion.

https://helpx.adobe.com/experience-manager/using/jackrabbit-users.html

Thanks,

Sambasivaraja

1 Accepted Solution

Avatar

Correct answer by
Level 4

Since I have been using deprecated API I was not able to create users in AEM.

Now this problem is resolved .Attached the sample screenshot .

Scott,

We can change the code accordingly to make work in AEM 6.x.Kindly let me know if you need any details.

 

Thanks,

Sambasivaraja.

View solution in original post

5 Replies

Avatar

Level 10

Reason why you are getting the exception is because that article states it is applicable for AEM version 5.6 and 5.5. 

You are still going to use the same API. The only difference may be the version. 

We will also put this on the list to update this community article to 6.x. 

Avatar

Level 10

Hi,

It is possible to create User programmatically using the APIs. As @Scott mentioned it may be difference of having different version of dependency. 

What is the error you are seeing ?

Avatar

Administrator

Hi Sambasivaraja

Please share the error message to debug it further.

AS mentioned by Scott, the article (UserManager API) was only tested for AEM 5.5 and 5.6, so it could be the case that in 6.1 dependencies version would have changed.

 

You can also create user pragmatically using CURL.

Link:- https://hashimkhan.in/2015/05/27/aem-with-curl/

User Management Commands:

  • Create a new User
     
1
curl -u admin:admin -FcreateUser= -FauthorizableId=hashim -Frep:password=hashim http://localhost:4502/libs/granite/security/post/authorizables
  • Create a new Group
     
1
curl -u admin:admin -FcreateGroup=group1 -FauthorizableId=testGroup1 http://localhost:4502/libs/granite/security/post/authorizables
  • Add a Property to an existing User
     
1
curl -u admin:admin -Fprofile/age=25 http://localhost:4502/home/users/h/hashim.rw.html
  • Create a User with a profile
     
1
curl -u admin:admin -FcreateUser=testuser -FauthorizableId=hashimkhan -Frep:password=hashimkhan -Fprofile/gender=male http://localhost:4502/libs/granite/security/post/authorizables
  • Create a new User as a member of a Group
     
1
curl -u admin:admin -FcreateUser=testuser -FauthorizableId=testuser -Frep:password=abc123 -Fmembership=contributor http://localhost:4502/libs/granite/security/post/authorizables
  • Add User to a Group
     
1
curl -u admin:admin -FaddMembers=testuser1 http://localhost:4502/home/groups/t/testGroup.rw.html
  • Remove a User from a Group
     
1
curl -u admin:admin -FremoveMembers=testuser1 http://localhost:4502/home/groups/t/testGroup.rw.html
  • Set a Users Group Memberships
     
1
curl -u admin:admin -Fmembership=contributor -Fmembership=testgroup http://localhost:4502/home/users/t/testuser.rw.html
  • Delete user and Group
     
1
curl -u admin:admin -FdeleteAuthorizable= http://localhost:4502/home/users/t/testusercurl -u admin:admin -FdeleteAuthorizable= http://localhost:4502/home/groups/t/testGroup
  • Change a user password
     
1
curl -u testuser:OLD_PWD -F rep:password=NEW_PWD http://localhost:4502/home/users/t/testuser.rw.htmlcurl rep:password=test user admin:admin http://localhost:4502/home/users/a/alister@geometrixx.com
 

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Correct answer by
Level 4

Since I have been using deprecated API I was not able to create users in AEM.

Now this problem is resolved .Attached the sample screenshot .

Scott,

We can change the code accordingly to make work in AEM 6.x.Kindly let me know if you need any details.

 

Thanks,

Sambasivaraja.