Foros de discusión
Liferay 7 Service Access Policies
Dustin Dertinger, modificado hace 6 años.
Liferay 7 Service Access Policies
New Member Mensaje: 1 Fecha de incorporación: 11/07/17 Mensajes recientes
I am writing an Application Display Template in Liferay 7 to create an infinite loading feature on an Asset Publisher Portlet, and I want a particular service's get calls to be exposed to guests. I am using the Liferay Javascript object to get a pAuth token using Liferay.authToken to pass with the request, and I have included 'com.liferay.portlet.blogs.service.impl.BlogsEntryServiceImpl' as a service signature in my default Service Access Policy based on the documentation at https://dev.liferay.com/discover/deployment/-/knowledge_base/7-0/service-access-policies. I have also attempted included that package with #get* at the end to be specific to what I want. I'm trying to call '/blogsentry/get-group-entries', and I got the package name to include in my Service Access Policy from the /api/jsonws page. I've tried to invoke this call through JavaScript and URL, and am only able to get a response when I am signed in. If I am not signed in, I get:
{"exception":"Authenticated access required","throwable":"java.lang.SecurityException: Authenticated access required","error":{"message":"Authenticated access required","type":"java.lang.SecurityException"}}
I can see the pAuth getting correctly appended to my request:
cmd:{"/blogsentry/get-group-entries":{"p_auth":"MljBI2cj","groupId":10282,"status":0,"start":6,"end":12}}
p_auth:MljBI2cj
Based on the service access policy docs I thought that adding an allowed service signature under control panel/configuration/service access policy would allow guest access, since I am including a pAuth token with my request - but I can't get this to work. After not getting these to work, I created my own service builder remote services and saw them successfully come through on the /api/jsonws page, but similarly, I have only been able to access these services while signed in (I also included this package in my service access policy as I did with the blogsEntry request).
Is there something that I am missing or doing wrong? In Liferay 7, how can I exposed json web services to guest calls so I can use web services in my UI?
{"exception":"Authenticated access required","throwable":"java.lang.SecurityException: Authenticated access required","error":{"message":"Authenticated access required","type":"java.lang.SecurityException"}}
I can see the pAuth getting correctly appended to my request:
cmd:{"/blogsentry/get-group-entries":{"p_auth":"MljBI2cj","groupId":10282,"status":0,"start":6,"end":12}}
p_auth:MljBI2cj
Based on the service access policy docs I thought that adding an allowed service signature under control panel/configuration/service access policy would allow guest access, since I am including a pAuth token with my request - but I can't get this to work. After not getting these to work, I created my own service builder remote services and saw them successfully come through on the /api/jsonws page, but similarly, I have only been able to access these services while signed in (I also included this package in my service access policy as I did with the blogsEntry request).
Is there something that I am missing or doing wrong? In Liferay 7, how can I exposed json web services to guest calls so I can use web services in my UI?
Tomas Polesovsky, modificado hace 6 años.
RE: Liferay 7 Service Access Policies
Liferay Master Mensajes: 676 Fecha de incorporación: 13/02/09 Mensajes recientes
Hi Dustin,
please don't use impl class name but the service name, i.e.
Also please note the "default" word in "default Service Access Policy" is a keyword. That means you must tick/check the "Default" field of SAP to be enabled.
Hope it helps.
please don't use impl class name but the service name, i.e.
com.liferay.blogs.service.BlogsEntryService
Also please note the "default" word in "default Service Access Policy" is a keyword. That means you must tick/check the "Default" field of SAP to be enabled.
Hope it helps.