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

How to get the Subject on a service that implements ResourceChangeListener


Level 3

On this official link

Service Users in AEM

it says that the prefered way to get a resource resolver is no longer the service users but the following:

3-Pass a serialization of the Subject in the event payload, and create a ResourceResolver based on that subject. One example would be using the JAAS doAsPrivileged in the ResourceResolverFactory.

Advantages: Clean implementation from a security standpoint. It avoids re-authentication and it operates with the original privileges. Security relevant code is transparent to the consumer of the event.

Disatvantages: Needs refactoring. The fact that the security relevant code transparent to the consumer of the event might also lead to problems.

But the question is how to get the Subject in a OSGI service that implements ResourceChangeListener to be able to serialize it and then passe it to the JobConsumer??

Can somebody post some quick example of how to get the subject/context?


1 Reply