Difference between different types of resource resolvers

Avatar

Avatar

Aryan12345

Avatar

Aryan12345

Aryan12345

15-12-2019

There are three ways in which I can get resource Resolver in AEM.

  1. Administrative resource resolver
  2. Service resource resolver with a system user
  3. Resource resolver from the request in a servlet.

Lets consider this scenario.

  1. Get an administrative resource resolver
  2. Get a service resource resolver with admin as the subservice user.
  3. Resource resolver from the request in a servlet (hit on author) after providing admin credentials as "basic authentication" say in postman.

Are these three not supposed to be the same? Quick and dirty code for What i mean. Please let me know what you think.

 

Not sure how to add code here so providing my Githib code link

https://github.com/GodaProjects/aem652/blob/feature/resource-resolver-2/core/src/main/java/com/goda/...

View Entire Topic

Avatar

Avatar

Ravi_Pampana

MVP

Avatar

Ravi_Pampana

MVP

Ravi_Pampana
MVP

15-12-2019

Hi

 

1. Get an administrative resource resolver
-- will have admin access even without passing any credentials and depreciated as it is not good practice. As it will give full access to add/delete/modify to the nodes for all requests.

Refer: https://aemmastery.com/heads-up-getadministrativeresourceresolver-is-deprecated-in-apache-sling-a5a2...

 

2. Get a service resource resolver with admin as the subservice user.
-- We can restrict the access of system user and provide access on need basis to the required class

Refer: https://taradevko.com/aem/aem-service-user-mapper-do-you-know-it/

 

3. Resource resolver from the request in a servlet (hit on author) after providing admin credentials as "basic authentication" say in postman.
-- Will have the access of the logged in user, if user is admin, we can get admin access from request or if user is not having delete access, performing delete will throw exception