cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Web Script Portlet rivet

rivetlogic
Champ on-the-rise
Champ on-the-rise
AWPr

AWPr is a JSR-168 portlet that can be used to expose remote Alfresco Web scripts, including those that need user authentication. With the help of a custom Alfresco authentication component that we wrote the portlet can carry the user credentials from the portal to Alfresco, authenticate the user in Alfresco and retrieve a ticket that can be used during all subsequent interactions between the end-user, the portlet and ultimately the Alfresco Web script itself.

Motivation for AWPr

When integrating Alfresco Web scripts with JBoss Portal or Liferay Portal AWPr alleviates the need for having to deploy all of Alfresco inside the portal as is the case when using Alfresco's OOTB (out-of-the-box) Web script portlet for Alfresco/Portal integration.

AWPr is also highly configurable. Through the use of portlet preferences you can create multiple instances of AWPr and configure each one with a different Web script URL and a set of parameters with default values if needed. The instance will then RESTfully fetch the result of the Web script's render phase and carry that over to the portlet finally rendering it on the screen within the confines of the portlet window.

It is hence possible to run two instances of AWPr on a single portal page where each instance is exposing a different Web script even if those Web scripts are hosted on two different Alfresco servers regardless of their geographic location.

AWPr lives here:
http://wiki.rivetlogic.org/display/AWPr/

Feel free to ask questions about AWPr in this thread.

–Alaaeldin
125 REPLIES 125

nowhere
Champ in-the-making
Champ in-the-making
Here I'm again…
I noticed that if I restart alfresco and liferay server and log in Liferay with userIdA (that is not in alfresco) I get the wished behauviour: the aWpr shows alfresco login interface.
If I log in with useridB (that is in Alfresco) awpr works fine because user is both in liferay and in alfresco. But if I log out and log in again with userIdA I get wrong behaouvior: I see my webscript, also if I shouldn't and at same time I get exception I said in previous post:

ERROR [web.scripts.AbstractRuntime] Exceptio
n from executeScript - redirecting to status template error: 08210143 Web Script
com/mine/quality/mywebscript.get requires user authentication; however, a gu
est has attempted access.

What I noticed is that the tickets generated are different between useridB and userIdB, so it's not a problem of caching or storing ticket.

Can anyone help me to understand?

Thanks Smiley Happy

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

You're seeing this behavior because it is how AWPr works. It was not intended for this use case. As a matter of fact the idea was that you should never see the Alfresco login screen inside an AWPr portlet so I'm curious as to how you were able to do that.

The way AWPr works is that it tries to authenticate with Alfresco as the logged-in portal user, and if a ticket cannot be created (i.e. login failed) then AWPr will attempt to access the configured webscript as a guest. That's why you're getting this exception.

–Alaaeldin

nowhere
Champ in-the-making
Champ in-the-making
Hi,
maybe because I disabled guestLoginAccess and my webscript has user authentication required?
Can I modify soure to change aWpr behaviour?

Thanks Smiley Happy

Edit: I'm usign 1.0.0 version for aWpr

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

Yes you can. The code is quite simple. You need to modify the top portion of the JSPPortlet.executeScript(…)


      if (alfTicket != null) {
         restParams.add(new NameValuePair(Constants.URL_PARAM_TICKET, alfTicket));
         restParams.add(new NameValuePair(Constants.URL_PARAM_ALFRESCO_TICKET, alfTicket));
      } else {
         restParams.add(new NameValuePair(Constants.URL_PARAM_GUEST, "true"));
      }

The else should be removed.

Hope this helps,

–Alaaeldin

nowhere
Champ in-the-making
Champ in-the-making
Hi Rivet,
I read that code portion, but there ticket is not null, even if alfresco user doesn't exist. This because JSPPortlet.java send always the same password "portal" that is recognized in SecureTokenAuthenticationImpl. I bypass it changing chaining-authentication-context.xml, but at the moment I can get only encrypted password from liferay and I can't do alfresco recognize user. Any suggestion?

Thanks for your attention Smiley Happy

rivetlogic
Champ on-the-rise
Champ on-the-rise
Is "createMissingPeople" set to false?

–Alaaeldin

nowhere
Champ in-the-making
Champ in-the-making
Yes, it's set to false. I wouldn't alfresco to create user connecting to it by the portlet…

rivetlogic
Champ on-the-rise
Champ on-the-rise
And when you login to Alfresco through AWPr what is the ticket that's returned? You can test that by executing the login webscript directly.

–Alaaeldin

nowhere
Champ in-the-making
Champ in-the-making
sorry, I didn't understand your question. Can you explain me?
Meanwhile I'm modifying aWPr portlet to get it working as I expected

rivetlogic
Champ on-the-rise
Champ on-the-rise
I thought about this some more and the use case you have is really not what AWPr is intended for. You need to be able to login to the portal as UserA and from within that session login to Alfresco via AWPr as UserB.

On the other hand AWPr is designed to seamlessly authenticate the portal user into Alfresco.

Sorry that I couldn't be more helpful.

–Alaaeldin