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.
SOLVED

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

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

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:

Selection_112.png

All mappings in an Amendment:

Selection_113.png

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!

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

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:

Selection_112.png

All mappings in an Amendment:

Selection_113.png

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!