Highlighted

Service Users in AEM 6.4

Avatar

Avatar

MihaiAnghel

Avatar

MihaiAnghel

MihaiAnghel

06-08-2018

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

Replies

Highlighted

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

06-08-2018

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

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

06-08-2018