Hi All,
I am trying to programmatically log-in from a WebEngine project context. The WebEngine's URL is configured as OpenURL using the OpenUrl extension point of PluggableAuthenticationService([OpenUrl]).
In the first view, WebContext(ctx).getPrincipal() returns null. At this point I need to login to the nuxeo with a pre-configured user so that I have a valid CoreSession on subsequent request. A call like WebContext(ctx).getCoreSession() throws exception like "Un-authenticated user trying to access core-session."
Following are the steps I already tried with no success:
1)
LoginContext lc = Framework.login(loginId, password);
Result: The logged-in users context is not propagated down the layers so that next time I call getCoreSession() I get the above exception.
2)
LoginContext lc = Framework.login(loginId, password);
request = wrapRequest(request, lc); // Uses HttpServletRequestWrapper
Result: Same exception.
3)
UserManager userManager = Framework.getService(UserManager.class);
NuxeoPrincipalImpl userPrin = (NuxeoPrincipalImpl)userManager.authenticate(loginId, password);
Result: The logged-in users context is not propagated down the layers.
Tried to use nuxeo-automation-client from inside the WebEngine by adding the respective jars, but get exception:
ERROR [org.nuxeo.ecm.webengine.app.WebEngineExceptionMapper] Exception in JAX-RS processing
java.lang.NoClassDefFoundError: org/nuxeo/ecm/automation/client/jaxrs/impl/HttpAutomationClient
What am I doing wrong. I can't find any API which does this. Or may be I am calling the wrong sequence of API calls. Please help.
Note:
A similar question was also asked in Nuxeo forums(Nuxeo Forum Question) on January 2009, he was directed to read Nuxeo book Chapter 10, but no concrete answer.
I have read the above chapter thoroughly. But can't see how this chapter can be help to me here.
Kindly help.
Regards
Nataraj