Hi Jörg,

Thank you for the quick reply. Here is a more detailed explanation of the
problem we are trying to solve:

The core issue is that the
`org.apache.jackrabbit.oak.spi.security.authentication.external.impl.jmx.SynchronizationMBean`
for Oak's external authentication is unavailable in a standard Apache Sling
application based on the Apache Sling Starter (
https://github.com/apache/sling-org-apache-sling-starter). This MBean is
essential for monitoring and managing external user synchronization.

Here's a breakdown of the situation:

1.  We have an instance of
`org.apache.jackrabbit.oak.spi.security.authentication.external.impl.ExternalLoginModuleFactory`
configured.
2.  Upon initialization, each `ExternalLoginModuleFactory` instance
registers its own `SynchronizationMBean` as a JMX MBean. However, this
registration only occurs if a
`org.apache.jackrabbit.oak.api.ContentRepository` service is registered in
the OSGi container. If no `ContentRepository` service is present, the
`SynchronizationMBean` is not registered (
https://github.com/apache/jackrabbit-oak/blob/b5c317af752b3c421c9d341a7cfca407dff29af5/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/ExternalLoginModuleFactory.java#L203-L206
).
3.  A standard Apache Sling application based on the Apache Sling Starter
does not register a `ContentRepository` service. You are correct that
`org.apache.sling.jcr.api.SlingRepository` provides similar functionality.
However, from the perspective of the `ExternalLoginModuleFactory`, this
does not matter because it specifically requires a `ContentRepository`
service for the MBean registration, and `SlingRepository` is not a
`ContentRepository` service neither delivers registration for that service.
4.  Consequently, no `SynchronizationMBean` instances are registered as JMX
MBeans in a standard Apache Sling application.

To solve this, we propose introducing a `ContentRepository` service
registration as demonstrated in this proof of concept:
https://github.com/apache/sling-org-apache-sling-jcr-oak-server/compare/master...ciechanowiec:sling-org-apache-sling-jcr-oak-server:poc-content-repo-registration
.

Do you think this is the correct approach? If so, I would be happy to
submit a pull request.

On 2025/06/30 05:49:00 Jörg Hoh wrote:
> Hi Herman,
>
> can you outline what problem you are trying to solve?
>
> Isn't the SlingRepository service (
>
https://sling.apache.org/apidocs/sling13/org/apache/sling/jcr/api/SlingRepository.html
)
> providing exactly the same functionality as the Oak ContentRepository ((
>
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-api/src/main/java/org/apache/jackrabbit/oak/api/ContentRepository.java
> )?
>
> Jörg
>
>
>
>
> Am Fr., 27. Juni 2025 um 17:42 Uhr schrieb Herman Ciechanowiec <
> her...@ciechanowiec.eu>:
>
> > Dear Apache Sling Team,
> >
> > Jackrabbit Oak has internal dependencies on the
> > org.apache.jackrabbit.oak.api.ContentRepository service. For instance,
the
> > registration of
> >
> >
org.apache.jackrabbit.oak.spi.security.authentication.external.impl.jmx.SynchronizationMBean
> > will not occur if a ContentRepository service is unavailable (see link
> > <
> >
https://github.com/apache/jackrabbit-oak/blob/b5c317af752b3c421c9d341a7cfca407dff29af5/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/ExternalLoginModuleFactory.java#L203-L206
> > >
> > ).
> >
> > However, the sling-org-apache-sling-jcr-oak-server bundle, which is
> > responsible for repository initialization and initializes the
> > ContentRepository object, does not register it as a ContentRepository
> > service type.
> >
> > What are your thoughts on changing this as demonstrated in my proof of
> > concept: link
> > <
> >
https://github.com/apache/sling-org-apache-sling-jcr-oak-server/compare/master...ciechanowiec:sling-org-apache-sling-jcr-oak-server:poc-content-repo-registration
> > >?
> > The change appears to be very simple, and I can submit a pull request
once
> > I receive confirmation that it is worth considering.
> > Kind regards,
> >
> > Herman Ciechanowiec
> > her...@ciechanowiec.eu
> >
>
>
> --
> https://cqdump.joerghoh.de
>

Kind regards,

Herman Ciechanowiec
her...@ciechanowiec.eu

Reply via email to