Fórum

Accessing Portlet with URL

Dhanya Mohan, modificado 9 Anos atrás.

Accessing Portlet with URL

New Member Postagens: 20 Data de Entrada: 20/01/14 Postagens Recentes
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
thumbnail
Jitendra Rajput, modificado 9 Anos atrás.

RE: Accessing Portlet with URL

Liferay Master Postagens: 875 Data de Entrada: 07/01/11 Postagens Recentes
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

 #
    # 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
thumbnail
G R Rajesh Babu, modificado 9 Anos atrás.

RE: Accessing Portlet with URL

Regular Member Postagens: 161 Data de Entrada: 08/02/10 Postagens Recentes
Hi Jitendra,
Can you please explain what does the 82 represent in the below mapping.

auth.token.ignore.portlets=82,mypaperlessportlet_WAR_mypaperlessportlet
thumbnail
Miroslav Ligas, modificado 9 Anos atrás.

RE: Accessing Portlet with URL

Regular Member Postagens: 152 Data de Entrada: 29/07/14 Postagens Recentes
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
thumbnail
G R Rajesh Babu, modificado 9 Anos atrás.

RE: Accessing Portlet with URL

Regular Member Postagens: 161 Data de Entrada: 08/02/10 Postagens Recentes
Miroslav 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, modificado 9 Anos atrás.

RE: Accessing Portlet with URL

New Member Postagens: 20 Data de Entrada: 20/01/14 Postagens Recentes
It worked.Thanks Jitendraemoticon
thumbnail
Miroslav Ligas, modificado 9 Anos atrás.

RE: Accessing Portlet with URL

Regular Member Postagens: 152 Data de Entrada: 29/07/14 Postagens Recentes
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?