struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <jeromy.ev...@blueskyminds.com.au>
Subject Re: how to set remoteuser
Date Wed, 27 Aug 2008 06:05:27 GMT
Hardik Shah wrote:
> hi
> we can get remoteuser using request.getremoteuser() but how we can set it?
>
> -----
>   

One approach is to wrap the request object.  Create a Filter, decorate 
the HttpServletRequest with one the implements setRemoteUser() and 
delegates all other methods to the original.  When getRemoteUser is 
invoked it checks it's local value first and if not set delegate to the 
wrapped request object.  Only your code needs to be aware of the special 
implementation in order to set the remote user.

A proxy of HttpServletRequest that does the same thing may also be 
possible. Not sure...

A better approach is to use the container's authentication as intended 
so the remoteUser is managed by it..




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message