Foros de discusión

liferay json services api/jsonws not accessible without login

thumbnail
sanket jani, modificado hace 9 años.

liferay json services api/jsonws not accessible without login

New Member Mensajes: 21 Fecha de incorporación: 19/08/14 Mensajes recientes
Hi guys,

I have problem with the json services.

I am using api/jsonws services to fetch data from the database as following.

http://localhost:8080/api/jsonws/beacon-portlet.addbeacon/find-by-id-key/id-key/1

1) when user not logged in on liferay, it gives {"exception":"Authenticated access required"}

2) when user is logged in, it returns the data successfully

I am using liferay 6.2 ga2 CE

Here is my impl class method,

public AlertContent findByBeaconIdKey(long beaconIdKey) throws NoSuchAlertContentException, com.liferay.portal.kernel.exception.SystemException
{
return alertContentPersistence.findByBeaconidkey(beaconidkey);
}


my portal-ext.properties as following

json.service.auth.token.hosts.allowed=127.0.0.1
json.service.auth.token.enabled=false
jsonws.web.service.public.methods=*


Need expert help plz at earliest.

Thanks
thumbnail
David H Nebinger, modificado hace 9 años.

RE: liferay json services api/jsonws not accessible without login

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
Is that your implementation in the AlertContentLocalServiceImpl or the AlertContentServiceImpl?
thumbnail
sanket jani, modificado hace 9 años.

RE: liferay json services api/jsonws not accessible without login

New Member Mensajes: 21 Fecha de incorporación: 19/08/14 Mensajes recientes
yes my implementation is in the AlertContentServiceImpl since i want to access finder methods by JSON web-services .
thumbnail
Shinn Lok, modificado hace 9 años.

RE: liferay json services api/jsonws not accessible without login

Junior Member Mensajes: 89 Fecha de incorporación: 14/01/11 Mensajes recientes
sanket jani:
Hi guys,

I have problem with the json services.

I am using api/jsonws services to fetch data from the database as following.

http://localhost:8080/api/jsonws/beacon-portlet.addbeacon/find-by-id-key/id-key/1

1) when user not logged in on liferay, it gives {"exception":"Authenticated access required"}

2) when user is logged in, it returns the data successfully

I am using liferay 6.2 ga2 CE

Here is my impl class method,

public AlertContent findByBeaconIdKey(long beaconIdKey) throws NoSuchAlertContentException, com.liferay.portal.kernel.exception.SystemException
{
return alertContentPersistence.findByBeaconidkey(beaconidkey);
}


my portal-ext.properties as following

json.service.auth.token.hosts.allowed=127.0.0.1
json.service.auth.token.enabled=false
jsonws.web.service.public.methods=*


Need expert help plz at earliest.

Thanks


jsonws.web.service.public.methods is no longer a property since 6.2.

You just need to annotate your method:

@AccessControlled(guestAccessEnabled=true)
public AlertContent findByBeaconIdKey(long beaconIdKey) throws NoSuchAlertContentException, com.liferay.portal.kernel.exception.SystemException
thumbnail
sanket jani, modificado hace 9 años.

RE: liferay json services api/jsonws not accessible without login

New Member Mensajes: 21 Fecha de incorporación: 19/08/14 Mensajes recientes
@AccessControlled(guestAccessEnabled=true)
this line worked with following property in portal-ext.properties
json.service.auth.token.enabled=false

Thanks for your expert help.
thumbnail
Raphael Ferreira, modificado hace 9 años.

RE: liferay json services api/jsonws not accessible without login

New Member Mensajes: 2 Fecha de incorporación: 27/08/14 Mensajes recientes
Hi Guys,

In my case I just acess any content used:
http://localhost:8081/api/jsonws/journalarticle/get-article?groupId=10182&articleId=PORTFOLIO

I had the same problem about authentication, I really like disable this.

How it is possible?

I've read and tried many tips but or there is a problem in the new version or're missing more properties.

Thank you for any help






My portal-ext.properties is below:
journal.article.force.autogenerate.id=false
http.header.secure.x.frame.options=false
axis.servlet.hosts.allowed=127.0.0.1
company.security.auth.type=emailAddress

auth.token.check.enabled=false
portlet.add.default.resource.check.enabled=false
auth.verifier.PortalSessionAuthVerifier.urls.excludes=\
/api/jsonws/*
auth.verifier.PortalSessionAuthVerifier.hosts.allowed= 127.0.0.1
json.deserializer.strict.mode=false
json.service.auth.token.enabled=false
json.service.auth.token.hosts.allowed=127.0.0.1
json.service.public.methods=*
jsonws.web.service.public.methods=*
jsonws.servlet.hosts.allowed=127.0.0.1
auth.token.ignore.origins=\
com.liferay.portal.jsonwebservice.JSONWebServiceServiceAction:/journalarticle/get-article