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);
//loginAdministrative(null);
/**/// AccountManager am = af.createAccountManager(adminsession);
String currentPagePath = request.getParameter("currentPagePath");
log.info("currentPagePath == "+ currentPagePath);
Page currentPage =null;
Resource currentResource = resourceResolver.getResource(currentPagePath);
if(currentResource != null){
log.info("current Resource == "+ currentResource);
currentPage = currentResource.adaptTo(Page.class);
}
log.info("current page == "+ currentPage);
if(currentPage == null){
currentPage = currentResource.getParent().adaptTo(Page.class);
log.info("parent page path -->"+currentPage.getPath());
}
log.info("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?
Thanks!
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
Do something like this:
AccountManagementService accountManagementService = sling.getService(AccountManagementService.class);
if (accountManagementService != null) { try { accountManagementService.requestAccount("test","test",null,"test@tes.com","/content/geometrixx/en/toolbar/account/accountrequest.html");
} catch (Exception e) {
log.error("Error requesting a password request");
}
Views
Replies
Total Likes