So, I might have a partial solution for you. As I'm still trying to work through the rest of mine which is very similar. I'm actually in the process of building a mashup site, however I need to be able to display portal login status and have a login form on the microsite, which isn't being hosted out of the portal. So basically I need to accomplish this via JSONP (JSON via callbacks). Ran into the same issue.
I don' t know if you have a similar issue with XSS with cookies, so I needed to make the following update to my portal-ext.properties:
1
2 #
3 # Set this to true to test whether users have cookie support before allowing
4 # them to sign in. This test will always fail if "tck.url" is set to true
5 # because that property disables session cookies.
6 #
7 session.test.cookie.support=false
Next to get around the login security problem, I created an 'empty' portlet that uses a FriendlyURLMapper, extending BaseFriendlyURLMapper.
My liferay-portlet-ext.xml defines this empty portlet as such:
1
2 <portlet>
3 <portlet-name>EXT_REMOTELOGIN</portlet-name>
4 <struts-path>ext/remotelogin</struts-path>
5 <friendly-url-mapper-class>com.ext.lvlstudios.portlet.remotelogin.RemoteLoginFriendlyURLMapper</friendly-url-mapper-class>
6 <preferences-unique-per-layout>false</preferences-unique-per-layout>
7 <use-default-template>false</use-default-template>
8 <restore-current-view>false</restore-current-view>
9 <private-request-attributes>false</private-request-attributes>
10 <private-session-attributes>false</private-session-attributes>
11 <render-weight>1</render-weight>
12 <add-default-resource>true</add-default-resource>
13 </portlet>
And my FriendlyURLMapper code is like this:
1
2package com.ext.lvlstudios.portlet.remotelogin;
3
4import java.util.Map;
5
6import javax.portlet.PortletMode;
7import javax.portlet.WindowState;
8
9import com.liferay.portal.kernel.portlet.BaseFriendlyURLMapper;
10import com.liferay.portal.kernel.portlet.LiferayPortletURL;
11import com.liferay.portal.kernel.portlet.LiferayWindowState;
12import com.liferay.portal.kernel.util.GetterUtil;
13import com.liferay.portal.kernel.util.Validator;
14
15public class RemoteLoginFriendlyURLMapper extends BaseFriendlyURLMapper {
16
17 @Override
18 public String getPortletId() {
19 return _PORTLET_ID;
20 }
21
22 @Override
23 public String buildPath(LiferayPortletURL portletURL) {
24
25 String friendlyURLPath = null;
26
27 String strutsAction = GetterUtil.getString(portletURL
28 .getParameter("struts_action"));
29
30 if (strutsAction.equals("/ext/remotelogin/view")) {
31 friendlyURLPath = "ext/remotelogin/jsonp";
32 }
33 if (Validator.isNotNull(friendlyURLPath)) {
34 portletURL.addParameterIncludedInPath("p_p_id");
35 portletURL.addParameterIncludedInPath("struts_action");
36 }
37
38 return friendlyURLPath;
39 }
40
41 @Override
42 public String getMapping() {
43
44 return _MAPPING;
45 }
46
47 @Override
48 public void populateParams(String friendlyURLPath,
49 Map<String, String[]> params) {
50
51 addParam(params, "p_p_id", _PORTLET_ID);
52 addParam(params, "p_p_lifecycle", "0");
53 addParam(params, "p_p_state", WindowState.NORMAL);
54 addParam(params, "p_p_mode", PortletMode.VIEW);
55
56 int x = friendlyURLPath.indexOf("/", 1);
57 int y = friendlyURLPath.length();
58
59 if ((x + 1) == y) {
60 addParam(params, "struts_action", "/portal/login");
61
62 return;
63 }
64
65 String type = friendlyURLPath.substring(x + 1, y);
66
67 if (type.equals("remotelogin/jsonp")) {
68 addParam(params, "p_p_lifecycle", "1");
69 addParam(params, "p_p_state", LiferayWindowState.EXCLUSIVE);
70
71 addParam(params, "struts_action", "/ext/remotelogin/view");
72 }
73
74 }
75
76 private static final String _MAPPING = "ext/remotelogin";
77 private static final String _PORTLET_ID = "EXT_REMOTELOGIN";
78
79
80}
So basically, I can do a form POST (via whatever means) to http://www.mywebsite.com/web/guest/home/-/ext/remotelogin/jsonp with the right parameters for my login action, and the mapper will hand it off to the the appropriate struts action.
Where I'm left right now is getting the response out of my action to work correctly. The action get's hit, but having problems with the forward not working always right and errors not getting sent to to the session. But I think the above should fix your issue.
Be kell jelentkezni ahhoz, hogy ez helytelenként legyen megjelölve.