Usage of Apache Sling Service User Mapper Service and Apache Sling Service User Mapper Service Amendment | Community
Skip to main content
sibim50528883
Level 2
April 12, 2020
Solved

Usage of Apache Sling Service User Mapper Service and Apache Sling Service User Mapper Service Amendment

  • April 12, 2020
  • 1 reply
  • 3640 views

Hi,

I am trying to configure the Service user mapper configuration. I am seeing the below two configurations available in config manager

1. Apache Sling Service User Mapper Service

2. Apache Sling Service User Mapper Service Amendment

 

I would like to know which configuration is necessary to create service user mapping, 1 or 2 and the difference between both.

I went through lot of sites and end up in confusion😓 on which one is must to configure service user mapping and if so, the use of the other.

Some of my colleagues told, configuring "Apache Sling Service User Mapper Service" is enough to map service to user.

 

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Theo_Pendle

Hello 🙂

The Apache Sling Service User Mapper Service is a global configuration, and that presents some difficulties because service user mappings are typically bundle-specific.

For example you have 2 sites deploys on one instance:

  • SiteA, whîch maps serviceA to userA
  • SiteB which maps serviceB to userB

In order to avoid having to do the mappings manually when the two sites are deployed, you add each to a configuration that is installed with your bundle. The problem then is that if you deploy siteA and then siteB, the siteA mapping will be overwritten by the siteB mapping! Basically, whichever bundle you deploy last will take precedence.

In order to solve this, the Apache Sling Service User Mapper Service Amendment (which not a configuration but a configuration factory) allows you to add one configuration per bundle. This way you can deploy both sites in whatever order and you'll still retain both configs 🙂 If you have a fresh instance and install ACS Commons, you can see this in practice:

Nothing in Apache Sling Service User Mapper Service:

All mappings in an Amendment:

If I were you, I would also use an Amendment, even if you only have one bundle to deploy... you never know what the future will bring!

1 reply

Theo_Pendle
Theo_PendleAccepted solution
Level 8
April 12, 2020

Hello 🙂

The Apache Sling Service User Mapper Service is a global configuration, and that presents some difficulties because service user mappings are typically bundle-specific.

For example you have 2 sites deploys on one instance:

  • SiteA, whîch maps serviceA to userA
  • SiteB which maps serviceB to userB

In order to avoid having to do the mappings manually when the two sites are deployed, you add each to a configuration that is installed with your bundle. The problem then is that if you deploy siteA and then siteB, the siteA mapping will be overwritten by the siteB mapping! Basically, whichever bundle you deploy last will take precedence.

In order to solve this, the Apache Sling Service User Mapper Service Amendment (which not a configuration but a configuration factory) allows you to add one configuration per bundle. This way you can deploy both sites in whatever order and you'll still retain both configs 🙂 If you have a fresh instance and install ACS Commons, you can see this in practice:

Nothing in Apache Sling Service User Mapper Service:

All mappings in an Amendment:

If I were you, I would also use an Amendment, even if you only have one bundle to deploy... you never know what the future will bring!

sibim50528883
Level 2
May 8, 2020
Perfect.......Thank you so much 🙂