Hi All,
We are upgrading from 5.4 to 6.1 .
To get JCR Session we used the below code
SlingRepository repo = sling.getService(SlingRepository.class);
Session session = repo.loginAdministrative(null);
Now while upgrading we want to use
loginService(String subServiceName, String workspace)
method of SlingRepository class as loginAdministrative method is deprecated .But we are not able to use it .
We are using this
Session session = repo.loginService(null,null);
We don't know what to send for subServiceName argument .
If anyone used this method please mention your code.
Thanks in advance
Solved! Go to Solution.
Views
Replies
Total Likes
As @scott mentioned, you can assign the user for a service and use that credentials to login
or you can also get session with the respective login like below
Session session = repo.login(new SimpleCredentials("admin", "admin".toCharArray()));
Views
Replies
Total Likes
You can create a dedicated user account for AEM OSGi services to use. Then you can use:
param.put(ResourceResolverFactory.SUBSERVICE, "datawrite");
ResourceResolver resolver = null;
try {
//Invoke the adaptTo method to create a Session used to create a QueryManager
resolver = resolverFactory.getServiceResourceResolver(param);
session = resolver.adaptTo(Session.class);
This is how you create a session in AEM 6:
Querying Adobe Experience Manager 6 data using the Sling getServiceResourceResolver method
Views
Replies
Total Likes
As @scott mentioned, you can assign the user for a service and use that credentials to login
or you can also get session with the respective login like below
Session session = repo.login(new SimpleCredentials("admin", "admin".toCharArray()));
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies