Foren
Accessing Portlet with URL
Dhanya Mohan, geändert vor 9 Jahren.
Accessing Portlet with URL
New Member Beiträge: 20 Beitrittsdatum: 20.01.14 Neueste Beiträge
Hi,
I want to create a portlet and it should be accessible by url without logging in.I want to go to action mapping and not default render mapping.Created a jsp page named encoded.jsp.
@ActionMapping(params = "action=encode")
public void encodedecode(ActionRequest actionRequest,ActionResponse actionResponse) {
actionResponse
.setRenderParameter("action", "gotoencoded");
}
@RenderMapping(params = "action=gotoencoded")
public ModelAndView showPaperlessencoded(RenderRequest renderRequest,RenderResponse renderResponse){
ModelAndView mv = new ModelAndView();
mv.setViewName("encoded");
return mv;
}
this is the action class.I deployed the portlet and i am able to access the portlet if the user is signed in by giving p-id and the action method in url.
http://localhost:7001/web/paperless?p_auth=LNJ7Pg6w&p_p_auth=533n9xA4&p_p_id=mypaperlessportlet_WAR_mypaperlessportlet&p_p_lifecycle=1&p_p_state=maximized&p_p_mode=view&_mypaperlessportlet_WAR_mypaperlessportlet_action=encode
but when try to access it withoout logging in,i am getting forbidden error.You do not have permission to access the requested resource.Please help me.thanks in Advance. I added this portlet to whitelist in portal-ext.properties
portlet.add.default.resource.check.whitelist=mypaperlessportlet_WAR_mypaperlessportlet
I want to create a portlet and it should be accessible by url without logging in.I want to go to action mapping and not default render mapping.Created a jsp page named encoded.jsp.
@ActionMapping(params = "action=encode")
public void encodedecode(ActionRequest actionRequest,ActionResponse actionResponse) {
actionResponse
.setRenderParameter("action", "gotoencoded");
}
@RenderMapping(params = "action=gotoencoded")
public ModelAndView showPaperlessencoded(RenderRequest renderRequest,RenderResponse renderResponse){
ModelAndView mv = new ModelAndView();
mv.setViewName("encoded");
return mv;
}
this is the action class.I deployed the portlet and i am able to access the portlet if the user is signed in by giving p-id and the action method in url.
http://localhost:7001/web/paperless?p_auth=LNJ7Pg6w&p_p_auth=533n9xA4&p_p_id=mypaperlessportlet_WAR_mypaperlessportlet&p_p_lifecycle=1&p_p_state=maximized&p_p_mode=view&_mypaperlessportlet_WAR_mypaperlessportlet_action=encode
but when try to access it withoout logging in,i am getting forbidden error.You do not have permission to access the requested resource.Please help me.thanks in Advance. I added this portlet to whitelist in portal-ext.properties
portlet.add.default.resource.check.whitelist=mypaperlessportlet_WAR_mypaperlessportlet
Jitendra Rajput, geändert vor 9 Jahren.
RE: Accessing Portlet with URL
Liferay Master Beiträge: 875 Beitrittsdatum: 07.01.11 Neueste Beiträge
As you can see there are two authentication token in your portlet URL.
p_auth ... Portal authentication token for CSRF protection
p_p_auth ... Portlet authentication token for add-default-resource protection
This token can be enabled/disabled with the property "auth.token.check.enabled" in portal properties.
I suggest try adding id of your portlet in following property of portal-ext.properties file
To learn more about authentication token please check this wiki.
Thank you,
Jitendra
p_auth ... Portal authentication token for CSRF protection
p_p_auth ... Portlet authentication token for add-default-resource protection
This token can be enabled/disabled with the property "auth.token.check.enabled" in portal properties.
I suggest try adding id of your portlet in following property of portal-ext.properties file
#
# Set a list of comma delimited portlet ids that will not be checked for an
# authentication token.
#
auth.token.ignore.portlets=82,mypaperlessportlet_WAR_mypaperlessportlet
To learn more about authentication token please check this wiki.
Thank you,
Jitendra
G R Rajesh Babu, geändert vor 9 Jahren.
RE: Accessing Portlet with URL
Regular Member Beiträge: 161 Beitrittsdatum: 08.02.10 Neueste Beiträge
Hi Jitendra,
Can you please explain what does the 82 represent in the below mapping.
auth.token.ignore.portlets=82,mypaperlessportlet_WAR_mypaperlessportlet
Can you please explain what does the 82 represent in the below mapping.
auth.token.ignore.portlets=82,mypaperlessportlet_WAR_mypaperlessportlet
Miroslav Ligas, geändert vor 9 Jahren.
RE: Accessing Portlet with URL
Regular Member Beiträge: 152 Beitrittsdatum: 29.07.14 Neueste Beiträge
82 is the Language portlet and it's the default value form portal.properties.
#
# Set a list of comma delimited portlet IDs that will not be checked for an
# authentication token.
#
auth.token.ignore.portlets=82
G R Rajesh Babu, geändert vor 9 Jahren.
RE: Accessing Portlet with URL
Regular Member Beiträge: 161 Beitrittsdatum: 08.02.10 Neueste BeiträgeMiroslav Ligas:
82 is the Language portlet and it's the default value form portal.properties.# # Set a list of comma delimited portlet IDs that will not be checked for an # authentication token. # auth.token.ignore.portlets=82
Oh, Ok Miroslav Ligas. Thanks.
Dhanya Mohan, geändert vor 9 Jahren.
RE: Accessing Portlet with URL
New Member Beiträge: 20 Beitrittsdatum: 20.01.14 Neueste Beiträge
It worked.Thanks Jitendra
Miroslav Ligas, geändert vor 9 Jahren.
RE: Accessing Portlet with URL
Regular Member Beiträge: 152 Beitrittsdatum: 29.07.14 Neueste Beiträge
What are you trying to achieve by the direct call to the action? Action should be called only when you changing the state of the portlet. Does this apply?