掲示板

liferay json services api/jsonws not accessible without login

thumbnail
9年前 に sanket jani によって更新されました。

liferay json services api/jsonws not accessible without login

New Member 投稿: 21 参加年月日: 14/08/19 最新の投稿
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
9年前 に David H Nebinger によって更新されました。

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

Liferay Legend 投稿: 14917 参加年月日: 06/09/02 最新の投稿
Is that your implementation in the AlertContentLocalServiceImpl or the AlertContentServiceImpl?
thumbnail
9年前 に sanket jani によって更新されました。

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

New Member 投稿: 21 参加年月日: 14/08/19 最新の投稿
yes my implementation is in the AlertContentServiceImpl since i want to access finder methods by JSON web-services .
thumbnail
9年前 に Shinn Lok によって更新されました。

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

Junior Member 投稿: 89 参加年月日: 11/01/14 最新の投稿
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
9年前 に sanket jani によって更新されました。

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

New Member 投稿: 21 参加年月日: 14/08/19 最新の投稿
@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
9年前 に Raphael Ferreira によって更新されました。

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

New Member 投稿: 2 参加年月日: 14/08/27 最新の投稿
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