Expand my Community achievements bar.

SOLVED

Nested array felix console Configuration issue

Avatar

Level 2

This issue is related to nested array in felix console configuraration.

Please find below code:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
   jcr:primaryType="sling:OsgiConfig"
   user.mapping="[com.adobe.granite.oauth.server=oauthservice,
  com.test.abc.project=[sling-scripting,serviceuser]]"/>

As we can see in below image the above code configuration ([sling-scripting,serviceuser]) should come in same line, but it is going in next line. After keeping comma(,) always moving the required configuration next line.

felix_config.PNG

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

In JSP or HTL, the user always be sling-scripting. Though inside other components, services or servlets, it will be based on your service user mapping configuration.



Arun Patidar

View solution in original post

10 Replies

Avatar

Level 10

Looks like data was entered wrong. To use this service - the syntax should be:

Event64.core:datawrite=data

where:

  • Event64.core – is the Bundle-SymbolicName value of the OSGi bundle this is developed in the upcoming sections of this article.
  • datawrite – the name of the sub service (you reference this value in the Java code - used in the repository.loginServicemethod)
  • data – the system user account with data privileges.

Avatar

Level 2

But the issue is something else, after building my above code, I am not able to keep [sling-scripting,serviceuser] in same section as you can find in above image.

[sling-scripting, is going to first section and serviceuser] is going to second question.

After installing bundle comma(,) is moving them in two different line.

Below is expected output after deploying

expected.PNG code

Thanks

Avatar

Level 10

Are you manually entering this line ?

Avatar

Level 10

Why are you using a comma?

You should use on each line the syntax i showed (from the docs)

Event64.core:datawrite=data

More information here - Service Users in AEM

No where does the syntax show use of a comma. Please enter the lines in the Apache Sling Service User Mapper service  according to the valid syntax.

From the Docs:

Service Users and Mappings

If the above fails, Sling 7 offers a Service User Mapping service, which allows to configure a bundle-to-user mapping and two corresponding API methods: SlingRepository.loginService() and ResourceResolverFactory.getServiceResourceResolver() which return a session/resource resolver with the privileges of a configured user only. These methods have the following characteristics:

  • They allow mapping services to users
  • They make it possinle to define sub-service users
  • The central configuration point is: org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl
  • service-id = service-name [ “:” subservice-name ]

  • service-id is mapped to a resource resolver and/or JCR repository user ID for authentication
  • service-name is the symbolic name of the bundle providing the service

Avatar

Level 2

I wanted to assign two different system user to same bundle.

Avatar

Level 10

According to docs - its 1-1. You need two separate lines.

Avatar

Level 10

Are those are the principleNames which you are mentioning ? Can you check the logs if it has logged anything for an invalid entry?

Avatar

Level 2

Yes correct it will be giving resourceReslver with above mentioned characteristics:

I am trying to get resourceResolver on JSP page from testuser. But, it Is returning me sling-scripting user. In above code I have mapped sling-scripting with testuser.

Avatar

Correct answer by
Community Advisor

Hi,

In JSP or HTL, the user always be sling-scripting. Though inside other components, services or servlets, it will be based on your service user mapping configuration.



Arun Patidar