Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: How to implement Token authentication for Liferay JSON remote services
I need to enable guest users to pass a token while accessing remote services and allows/deny users from using the service based on token validation. I'm hoping to do this validation in some pipelines. These remote services should be accessible from other apps outside the Liferay. How to implement this in Liferay DXP 7.0?
Hey Vishnu, If I am getting your question, You want to authenticate user by custom token instead of few existing method on Liferay (Basic, OAuth). If yes, Then we can do it by implementing custom AuthPipeline in Liferay. Find example code (here). It is for Liferay 6.2 I will try to update it for 7.1/7.2.
Thanks, Krishna. I actually tried your code but it's not working on 7.0. I really appreciate it if you can try reproducing it to 7.0.
krishna patel:
Hey Vishnu, If I am getting your question, You want to authenticate user by custom token instead of few existing method on Liferay (Basic, OAuth). If yes, Then we can do it by implementing custom AuthPipeline in Liferay. Find example code (here). It is for Liferay 6.2 I will try to update it for 7.1/7.2.
I have updated AuthVerifier for liferay 7.1. Find release here(https://github.com/krishnaapatel/LiferayCustomAuthVerifier/releases/tag/v2.0). Any updates/pull requests are welcome.
Hi Vishnu,
Have you already tried add your service and method under Control Panel > Configuration > Policy Access Service? Adding your service there you remove authentication to access your service.
Have you already tried add your service and method under Control Panel > Configuration > Policy Access Service? Adding your service there you remove authentication to access your service.
It will make the service open without any authentication right. I don't want that. I just need to use a token-based authentication instead of the basic auth when accessing it remotely.
Danilo Buzar:
Hi Vishnu,
Have you already tried add your service and method under Control Panel > Configuration > Policy Access Service? Adding your service there you remove authentication to access your service.
Hi ,
You can try OAuth2 also, in this user can send the client id and client secret to get the token and use that to access services, you can refer below
https://help.liferay.com/hc/en-us/articles/360018176511-Authorizing-Account-Access-with-OAuth2#client-credentials-and-resource-owner-flows
You can try OAuth2 also, in this user can send the client id and client secret to get the token and use that to access services, you can refer below
https://help.liferay.com/hc/en-us/articles/360018176511-Authorizing-Account-Access-with-OAuth2#client-credentials-and-resource-owner-flows