I have seen the same issue as I have listed numerous times in this forum and everything suggested I appear to have done.
Here is my simple class, all I am trying to do at this point is create an instance of a user manager and be done.
@Component(immediate = true, service = Servlet.class, property = { Constants.SERVICE_DESCRIPTION + "=User Sync",
"sling.servlet.methods=GET", "sling.servlet.paths=/services/userSync" })
public class UserSyncServlet extends SlingAllMethodsServlet {
private static final long serialVersionUID = 1L;
private static final Logger LOGGER = LoggerFactory.getLogger(UserSyncServlet.class);
private Session adminSession;
@Reference
private ResourceResolverFactory resolverFactory;
protected void doGet(final SlingHttpServletRequest req, final SlingHttpServletResponse resp)
throws ServletException, IOException {
resp.setContentType("text/plain");
resp.getWriter().write("User Sync POC\n");
ResourceResolver resolver = null;
try {
Map<String, Object> authInfoParam = new HashMap<String, Object>();
authInfoParam.put(ResourceResolverFactory.SUBSERVICE, "dataservice");
resp.getWriter().write(authInfoParam + "\n");
if (resolverFactory != null) {
resolver = resolverFactory.getServiceResourceResolver(authInfoParam);
adminSession = resolver.adaptTo(Session.class);
final UserManager userManager = resolver.adaptTo(UserManager.class);
} else {
resp.getWriter().write("Resolver is null\n");
}
} catch (Exception e) {
resp.getWriter().write("Exception..." + e.getMessage() + "\n");
} finally {
if (adminSession != null && adminSession.isLive()) {
adminSession.logout();
}
if (resolver != null)
resolver.close();
}
}
}
When I run this I get this...
User Sync POC
{sling.service.subservice=dataservice}
Resolver is null
My bundle is named thusly...
com.charter.panorama.bluesky.aem.AEMUserSync.core
My user mapper is set up like this
com.charter.panorama.bluesky.aem.AEMUserSync.core:dataservice=datawrite
And datawrite is a SYSTEM user, created thru the JCR and also I checked it is a member of the admins group and, just to be double sure has all permissions checked in the useradmin tool.
What am I doing wrong?
If it helps, the only logs this seems to throw out to help me are on the sync.log
01.05.2019 13:00:02.938 *DEBUG* [qtp1919192112-69] org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule Login: retrieving Credentials using callback.
01.05.2019 13:00:02.938 *DEBUG* [qtp1919192112-69] org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule Login: No supported credentials obtained from callback; trying shared state.
01.05.2019 13:00:02.938 *DEBUG* [qtp1919192112-69] org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule Login: No supported credentials found in shared state; looking for credentials in subject.
01.05.2019 13:00:02.938 *DEBUG* [qtp1919192112-69] org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule No credentials found.
01.05.2019 13:00:02.938 *DEBUG* [qtp1919192112-69] org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule Login: retrieving Credentials using callback.
01.05.2019 13:00:02.938 *DEBUG* [qtp1919192112-69] org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule Login: No supported credentials obtained from callback; trying shared state.
01.05.2019 13:00:02.939 *DEBUG* [qtp1919192112-69] org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule Login: No supported credentials found in shared state; looking for credentials in subject.
01.05.2019 13:00:02.939 *DEBUG* [qtp1919192112-69] org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule No credentials found.
01.05.2019 13:00:02.962 *DEBUG* [qtp1919192112-69] org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule Login: retrieving Credentials using callback.
01.05.2019 13:00:02.964 *DEBUG* [qtp1919192112-69] org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule Login: Credentials 'org.apache.jackrabbit.api.security.authentication.token.TokenCredentials@22d5bd39' obtained from callback
01.05.2019 13:00:02.969 *DEBUG* [0:0:0:0:0:0:0:1 [1556733602967] GET /services/userSync HTTP/1.1] org.apache.jackrabbit.oak.spi.security.authentication.external.impl.ExternalLoginModule No 'SupportedCredentials' configured. Using default implementation supporting 'SimpleCredentials'.
it does seem to indicate some creds are pulled back but it ends with No 'SupportedCredentials' configured.
so that seems to be my issue but going thru video demo's I seem to have set up everything correctly.
Please help.
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Follow this exact article - it works nicely
Views
Replies
Total Likes
Did you open your bundle and look at the Symbolic name in the MF file?
Did you follow these instructions to create the System user?
To successfully query JCR data, create an Experience Manager System user by performing these tasks.
1. Open http://localhost:4502/crx/explorer/index.jsp.
2. Login as admin.
3. Click User Administration.
4. Click Create System User. Name the user data (data is used in this article).
5. Set the UserId.
6. Click Save
7. Access the user page at http://localhost:4502/useradmin.
8. Select the data user.
9. From the right-hand pane, select the Permissions tab.
10. Expand the content tab and then select the employees row.
11. Click all the checkboxes that represent the permissions (click the top row in permissions for this example).
12. Click the Save button located in the top menu bar (located above the Path heading).
Views
Replies
Total Likes
Here is my manifest file, it should be the 'Bundle-SymbolicName: com.charter.panorama.bluesky.aem.AEMUserSync.core' right
which is does
Manifest-Version: 1.0
Bnd-LastModified: 1556729253514
Build-Jdk: 1.8.0_162
Built-By: JStarling
Bundle-Description: Core bundle for AEMUserSync
Bundle-ManifestVersion: 2
Bundle-Name: AEMUserSync - Core
Bundle-SymbolicName: com.charter.panorama.bluesky.aem.AEMUserSync.core
Bundle-Version: 1.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Package: com.foo.community.core;version="1.0.0";uses:="javax.se
rvlet,org.apache.sling.api,org.apache.sling.api.servlets"
Import-Package: javax.jcr;version="[2.0,3)",javax.servlet,org.apache.j
ackrabbit.api.security.user;version="[2.3,3)",org.apache.sling.api;ve
rsion="[2.3,3)",org.apache.sling.api.resource;version="[2.8,3)",org.a
pache.sling.api.servlets;version="[2.1,3)",org.slf4j;version="[1.5,2)
"
Provide-Capability: osgi.service;objectClass:List<String>="javax.servl
et.Servlet"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/com.foo.community.core.UserSyncServlet.xml
Sling-Model-Packages: com.foo.community.core
Tool: Bnd-3.3.0.201609221906
And as for system user, yes I did, permissions are all checked as well as being part of the admin group
and I verified the user thru crx/de is of type rep:SystemUser
Follow this exact article - it works nicely
Views
Replies
Total Likes
I can go thru it all again, can you tell me if the sync.log output I added is an indication of the error I am seeing or am I barking up the wrong tree on that one?
Link says 404.Can you check
Views
Replies
Total Likes
I do not think that error is related. Try the article step by step. It does work - as you can see the video at the end.
Views
Replies
Total Likes
Please find the working example of getting subservice session in servlet at aem63app-repo/SeesionInServletWithSubservice.java at master · arunpatidar02/aem63app-repo · GitHub
Well thank you kindly, my issue was basically my pom was screwed up.
crossing examples from adobe (older with newer) did not work out well
My issue was that I was NOT using
import org.osgi.service.component.annotations.Reference;
but the old
import org.apache.felix.scr.annotations.Reference;
When I switched this over I was having compiler issues
then I used your example to rework my pom file
and success!
Thank you so much
I am very glad it worked for you. This the entire purpose of these working code examples.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies