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
Thanks for thinking about!
Anyway I'm succeeding in getting my desidered behaviour…an user is authenticated in aWpr (alfresco) only if he is an alfresco user too. I modified code and it now seems to work.

Still thanks for your help, you was so friendly 🙂

meritant
Champ in-the-making
Champ in-the-making
Hello Alaaeldin, me again.

Unfortunately still no clue what's wrong with my setup Smiley Sad. Today I tried Alfresco 3.1 Enterprise instead of 3.2 CE, same behavior. To confirm my consumption, authentification doesn't work, I turned off automatic user creation within Alfresco. As expected, AWPr My Spaces displayed an Alfresco login screen.

What i did in detail:
- set up Liferay 5.2.3 bundled with Tomcat 5.5.27 (localhost:8081, AJP port 8010)
- set up Alfresco 3.2CE/3.1E bundled with Tomcat 6.0.x (localhost/alfresco:8080, AJP port 8011)
- installed Apache (localhost) with mod_jk

http.conf:
JkMount  /alfresco worker_alfresco
JkMount  /alfresco/* worker_alfresco
JkMount /* worker_liferay
workers.properties:
# Setting Tomcat & Java Home
#workers.tomcat_home="C:/Alfresco/tomcat"
workers.tomcat_home="C:/Liferay/tomcat-5.5.27"
workers.tomcat_home="C:/Alf3.1E/tomcat"
workers.java_home="C:/Program Files/Java/jdk1.6.0_07"
ps=\

worker.list=worker_alfresco,worker_liferay

# Set properties for worker 'worker_alfresco' (ajp13)
worker.worker_alfresco.type=ajp13
worker.worker_alfresco.host=localhost
worker.worker_alfresco.port=8011

# Set properties for worker 'worker_liferay' (ajp13)
worker.worker_liferay.type=ajp13
worker.worker_liferay.host=localhost
worker.worker_liferay.port=8010
- used Alfresco MMT to install "AWPrExampleWebScripts" and "SecureTokenAuthenticationRivet"
- created chaining-authentication-context.xml and used the code from your wiki-site

Anything I forgot or could have done wrong?


Kind regards and thank you very much in advance.



Hello Alaaeldin,

AWPr looks really great, thank you for contributing it to the community! I managed to get the AWPr My Spaces Web script working, but unfortunately Alfresco (3.2 CE) creates for every user an account instead of assigning the matching Alfresco-User. Liferay (5.2.3) and Alfresco do have the exact same users in it, same e-mail-addresses, Liferay screennames matches Alfresco's user names and Home Space names, what am I doing wrong?

I already checked my alfresco.war using alfresco-mmt-3.2.jar list, modules "AWPrExampleWebScripts" and "SecureTokenAuthenticationRivet" are installed and I used the chaining-authentication-context.xml from your wiki-page.

Any help would be much appreciated, thank you in advance.
Hi,

Thanks for the kind words. We haven't had a chance to test AWPr with Alfresco 3.2 yet. But I think it should work unless Alfresco's chaining authentication XML changed since Alfresco version 3.1.

I'll update this thread when we get around to trying it out.

Cheers,

–Alaaeldin

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

Which webscript are you trying to access through AWPr? Can you also post the AWPr instance configuration you're using? Also, you should be using the latest version of AWPr (1.5.0). You should also use the latest versions of STAr and the example webscripts (if you're gonna be using them):

star-1.1.0.amp
awpr-example-webscripts-1.5.0.amp

Cheers,

–Alaaeldin

meritant
Champ in-the-making
Champ in-the-making
Hi Alaaeldin,

only latest versions are in use. I also made sure, I got the awpr.war for Liferay 5.2.x.

Alfresco says at startup:
11:58:03,081 User:System INFO  [repo.module.ModuleServiceImpl] Starting module 'SecureTokenAuthenticationRivet' version 1.1.0.
11:58:03,159 User:System INFO  [repo.module.ModuleServiceImpl] Starting module 'AWPrExampleWebScripts' version 1.5.0.
Liferay says at startup:
09:54:58,407 INFO  [PortletHotDeployListener:227] Registering portlets for awpr
09:54:58,438 WARN  [PortletLocalServiceImpl:499] Portlet with the name awpr_WAR_
awpr is described in portlet.xml but does not have a matching entry in liferay-portlet.xml
09:54:58,485 INFO  [PortletHotDeployListener:346] 1 portlet for awpr is available for use

The AWPr-Preferences within your My Spaces Web script are set to:
Alfresco Host: http://localhost
Alfresco Context Path: /alfresco
Script Url: /ui/awprmyspaces
Constant Script Parameters: {alfUrl}[http://localhost/alfresco]
Default Script Parameters: {f}[0],{p}[/Company Home/]
Proxy URLs: {/ui/awprmyspaces}
Javascript Variable: uiawprmyspaces
REST Method Type: GET
URL Encoding Type: UTF-8


Cheers.

rivetlogic
Champ on-the-rise
Champ on-the-rise
Everything looks right. What error are you getting?

–Alaaeldin

meritant
Champ in-the-making
Champ in-the-making
No error message at all, Alfresco just creates for every Liferay-user accessing the My Spaces Web script an account within Alfresco instead of matching the Liferay-user to the appropriate account within Alfresco. With this automatic created user My Spaces Web script works fine, creating spaces, uploading files, browsing the spaces, everything works… but this account of course doesn't have the intended userrights, the Liferay-user should have because of matching him with his Alfresco-account.

Turning Alfresco's automatic user creation off, My Spaces Web script shows an Alfresco-loginscreen. So it must be something with authentication, but I have no clue what it could be Smiley Sad. Do you have any idea?


Kind regards and have a nice weekend.

rivetlogic
Champ on-the-rise
Champ on-the-rise
Something doesn't make sense in what you said. In Alfresco usernames are unique. So if you login to the portal with a username that username "must" exist in Alfresco for AWPr authentication to work. So either create the user in Alfresco ahead of time or Alfresco will create it for you. Since you're using Liferay you must be careful since Liferay allows you to login using userid, e-mail, or screenname. Whatever the username is that you type in Liferay's login is has to be the username in Alfresco. So if you login to Liferay with an e-mail address then the username of the user in Alfresco must also be the e-mail address.

Hope this helps,

–Alaaeldin

meritant
Champ in-the-making
Champ in-the-making
Hi Alaaeldin

So either create the user in Alfresco ahead of time or Alfresco will create it for you. Since you're using Liferay you must be careful since Liferay allows you to login using userid, e-mail, or screenname. Whatever the username is that you type in Liferay's login is has to be the username in Alfresco. So if you login to Liferay with an e-mail address then the username of the user in Alfresco must also be the e-mail address.
That's exactly what I did Smiley Sad. Liferay's login was set to username and I created within Alfresco all users with this username. For testing I now changed to e-mail address as Liferay's login and created a new user within Alfresco using this e-mail address as user name - same behavior, Alfresco creates an own Alfresco user. But I figured out, no matter what login (screenname or e-mail address) I use in Liferay, Alfresco takes the Liferay User-ID to create the new account within Alfresco. If I create the Alfresco user with this Liferay User-ID as user name, everything works fine. But of course, this five digit number is not what I want to be the user name in Alfresco, e-mail address or Liferay username (depending on what Liferay's login is set) would be better. And that's what I'm not able to achieve. I hope it's not to confusing what I'm writing.

Thanks again and kind regards.

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

This seems to imply that you're using the JBoss Portal version of AWPr since it makes the standard Portlet API call to get the portal username, while the Liferay version makes a different call.

Are you sure you're using the Liferay version of AWPr?

–Alaaeldin

meritant
Champ in-the-making
Champ in-the-making
Oh my god, that's it! Actually I really downloaded the wrong awpr.war and I did all my testing and seting up new installations with this wrong file from my HDD, not even once I downloaded this file again :roll:.

I'm so sorry for wasting your time because of my own stupidity. But hands down, not only AWPr is a great piece of software, also your efforts supplying support is just awsome. Thank you very much!