Fórumok

How to get HttpServletRequest object from within Authenticator class?

thumbnail
Ricky Bobby, módosítva 14 év-val korábban

How to get HttpServletRequest object from within Authenticator class?

Junior Member Bejegyzések: 32 Csatlakozás dátuma: 2006.07.31. Legújabb bejegyzések
Hi,

I'm implementing custom Authenticator class and am wondering if it is possible to get the HttpServletRequest and HttpServletResponse objects. How do one go about doing this?


Thanks
thumbnail
Ricky Bobby, módosítva 14 év-val korábban

RE: How to get HttpServletRequest object from within Authenticator class?

Junior Member Bejegyzések: 32 Csatlakozás dátuma: 2006.07.31. Legújabb bejegyzések
The class that I'm implementing is com.liferay.portal.security.auth.Authenticator

Again, is it possible to get the HttpServletRequest or PortletRequest from within the implemented class?
Khaja Shaik, módosítva 14 év-val korábban

RE: How to get HttpServletRequest object from within Authenticator class?

New Member Bejegyzések: 23 Csatlakozás dátuma: 2009.06.09. Legújabb bejegyzések
Hi Rick,

Try the following code in your Autherntication class.

HttpServletRequest origrequest = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(renderRequest));

and origrequest object will have all your request parameters.




Thanks,
KK
Dave Godbey, módosítva 13 év-val korábban

RE: How to get HttpServletRequest object from within Authenticator class?

New Member Bejegyzések: 9 Csatlakozás dátuma: 2010.06.28. Legújabb bejegyzések
This isn't going to work, is it? The renderRequest is not present in the authenticator.
thumbnail
Hir O, módosítva 12 év-val korábban

RE: How to get HttpServletRequest object from within Authenticator class?

Junior Member Bejegyzések: 30 Csatlakozás dátuma: 2012.03.14. Legújabb bejegyzések
have you solved this problem??
thumbnail
Ricky Bobby, módosítva 14 év-val korábban

RE: How to get HttpServletRequest object from within Authenticator class?

Junior Member Bejegyzések: 32 Csatlakozás dátuma: 2006.07.31. Legújabb bejegyzések
I solved my problem with ThreadLocal approach. I save the request and the response objects into the ThreadLocal variables from within the filter, then I can have access these 2 objects from anywhere within my application providing that your thread is still running/valid.

Google with HttpServletRequest and ThreadLocal as keywords for samples.
thumbnail
Brian Kim, módosítva 14 év-val korábban

RE: How to get HttpServletRequest object from within Authenticator class?

Expert Bejegyzések: 311 Csatlakozás dátuma: 2004.08.17. Legújabb bejegyzések
Rather than saving the entire request and response objects to the ThreadLocal, it would seem better to just save the attributes that you need.
Dave Godbey, módosítva 13 év-val korábban

RE: How to get HttpServletRequest object from within Authenticator class?

New Member Bejegyzések: 9 Csatlakozás dátuma: 2010.06.28. Legújabb bejegyzések
If you look at this the other way around, is there a utility that returns the session authenticator object?
thumbnail
ALex joubert, módosítva 10 év-val korábban

RE: How to get HttpServletRequest object from within Authenticator class?

Junior Member Bejegyzések: 27 Csatlakozás dátuma: 2010.03.19. Legújabb bejegyzések
HI

How Can I Use : SessionErrors.add (request, "Exception");

I can not retrieve request in a class that inherits from Authenticator

I want to display a custom message with "liferay-ui:error"
thumbnail
Krzysztof Gołębiowski, módosítva 10 év-val korábban

RE: How to get HttpServletRequest object from within Authenticator class?

Liferay Master Bejegyzések: 549 Csatlakozás dátuma: 2011.06.25. Legújabb bejegyzések
Hello Alex,
I've done once custom message from authenticator (but that was long time ago so I don't remember exactly how it was done). I think I had to throw some specific custom exception from Authenticator and then display proper message in JSP.

I will try to find some code tomorrow.

Regards,
KG