Forums de discussion

Connecting from servlet to login to liferay

giri reddy, modifié il y a 8 années.

Connecting from servlet to login to liferay

Junior Member Publications: 61 Date d'inscription: 27/02/15 Publications récentes
We get user name /password in OAuth based servlet. I am wondering if there is way servlet can simulate submitting userid/password to login hook. It is possible to do with redirection to browser and browser submitting credentials to login hook. Wondering if we can avoid redirection to browser.

If not to login hook is there any api to connect directly to liferay authteniction process.

We are using Liferay 5.2.3. Appreciate your help.
thumbnail
David H Nebinger, modifié il y a 8 années.

RE: Connecting from servlet to login to liferay

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
The login form just submits to Liferay so you can always do the same.
giri reddy, modifié il y a 8 années.

RE: Connecting from servlet to login to liferay

Junior Member Publications: 61 Date d'inscription: 27/02/15 Publications récentes
David H Nebinger:
The login form just submits to Liferay so you can always do the same.

Thanks David for quick reply. I am considering this solution. Unfortunately, it needs redirection to the browser where form need to be submitted. I am wondering if servlet itself can call proper classes that should behave exactly like submitting the form. I am not sure if it is possible to submit to login form from the servlet.
thumbnail
David H Nebinger, modifié il y a 8 années.

RE: Connecting from servlet to login to liferay

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
not sure why you think that. A submit of a form to Liferay will be handled in the same way as a login form submit so the portal will be redirecting user to their home page. Alternatively you can include the redirect param to control where the user lands.
giri reddy, modifié il y a 8 années.

RE: Connecting from servlet to login to liferay

Junior Member Publications: 61 Date d'inscription: 27/02/15 Publications récentes
David H Nebinger:
not sure why you think that. A submit of a form to Liferay will be handled in the same way as a login form submit so the portal will be redirecting user to their home page. Alternatively you can include the redirect param to control where the user lands.


I can try using HttpURLConnection to submit to login hook with user id , password and send back response to user. I wonder if I need to propagate cookies.

Let me know if I am missing anything. Is there stanard redirect parameter or I need to use jquery to rediect myself? Appreciate for the help.
thumbnail
David H Nebinger, modifié il y a 8 années.

RE: Connecting from servlet to login to liferay

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
Gotcha, yeah, don't think that would work.

First the cookie is tied to the session and the servlet would actually have a different session than the user's browser. The cookie itself would have a different value, so it may not work at all really.
giri reddy, modifié il y a 8 années.

RE: Connecting from servlet to login to liferay

Junior Member Publications: 61 Date d'inscription: 27/02/15 Publications récentes
David H Nebinger:
Gotcha, yeah, don't think that would work.

First the cookie is tied to the session and the servlet would actually have a different session than the user's browser. The cookie itself would have a different value, so it may not work at all really.

Thanks David. That clears out. I can redirect to the browser.