Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Service Users in AEM 6.4

Avatar

Level 1

Hello,

I am trying to implement an event listener in AEM 6.4 and apparently the SlingRepository.loginAdministrative() has been deprecated. According to the documentation, service users should be used instead for obtaining a session. The issue is that the documentation on using service users in the code is quite light. Other than Service Users in AEM , which describes the creation of service users, I haven't found anything detailed about actually using q service user for getting a session object.

Can you please point to any relevant documentation ?

Thank you

2 Replies

Avatar

Community Advisor

Hi,

Once you created system user and gave all the necessary permission. The you need to create a mapping to configure a bundle-to-user mapping, for that you can create new config like below:

service Mapping => <bundle Symbolic Name>:<Any-serviceName>=<systemuser>

Screen Shot 2018-08-06 at 3.34.49 PM.png

You can get session from service user like below

session = repository.loginService("readService", null);

where readService is service name

Thanks

Arun



Arun Patidar