Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments

AccountManagementService : AEM 6.2


Level 3

Hello All ,

We are currently working on AccountManagerService For Aem 6.2 as AccountManager and AccountManagerFactory seems to be depreceated.

We have our functional code as below :

            ResourceResolver resourceResolver= request.getResourceResolver();
             adminsession = resourceResolver.adaptTo(Session.class);
            //adminsession = repos.loginService(null, null);
        /**///    AccountManager am = af.createAccountManager(adminsession);
            String currentPagePath = request.getParameter("currentPagePath");
  "currentPagePath == "+ currentPagePath);
            Page currentPage =null;
            Resource currentResource = resourceResolver.getResource(currentPagePath);
            if(currentResource != null){
      "current Resource == "+ currentResource);
                currentPage = currentResource.adaptTo(Page.class);
  "current page == "+ currentPage);
            if(currentPage == null){
                currentPage = currentResource.getParent().adaptTo(Page.class);
      "parent page path -->"+currentPage.getPath());
  "current page path == "+ currentPage.getPath());
            cug_enabled = currentPage.getProperties().get("enableCUG", "false");
            group = currentPage.getProperties().get("cq:cugPrincipals","null");
            redirectURL = currentPage.getProperties().get("cq:cugLoginPage","currentPage");

From above can you please suggest on how we can replace AccountManager and AccountManagerFactory methods(highlighted bold) with new interface of AccountManagementService?


2 Replies


Level 10

Here is the JavaDocs for this API:

I am not sure if we have an example of using this API. I will look to see if there is an example. 


Level 8

Do something like this:

AccountManagementService accountManagementService = sling.getService(AccountManagementService.class);  

if (accountManagementService != null) {        try {                      accountManagementService.requestAccount("test","test",null,"","/content/geometrixx/en/toolbar/account/accountrequest.html");    

   } catch (Exception e) {        

   log.error("Error requesting a password request");