You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Gary Hardy <ga...@gjhconsulting.com> on 2003/11/18 21:24:41 UTC

setUserPrincipal

I'm going around google circles... Within a servlet how do you go about
creating a java.security.Principal given a username and password? i.e.
how-to login within a servlet given a username and password?

Thanks,
gary...


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


Re: setUserPrincipal

Posted by Bill Barker <wb...@wilshire.com>.
"Christopher Schultz" <ch...@comcast.net> wrote in message
news:3FBA8978.2060007@comcast.net...
> Gary,
>
> > I'm going around google circles... Within a servlet how do you go about
> > creating a java.security.Principal given a username and password? i.e.
> > how-to login within a servlet given a username and password?
>
> You can't do what you want to do, here. You can't use app-level security
> to set the principal for a container-level security policy :(
>
> If you want, you can implement a Filter that wraps your
> HttpServletRequest object with something you write yourself which does
> have this ability. Or, you can set the principal when you wrap the
> request...
>

However, if you want it to work with security-contraints in your web.xml,
you likely need to implement your own Realm.

> -chris




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


Re: setUserPrincipal

Posted by Christopher Schultz <ch...@comcast.net>.
Gary,

> I'm going around google circles... Within a servlet how do you go about
> creating a java.security.Principal given a username and password? i.e.
> how-to login within a servlet given a username and password?

You can't do what you want to do, here. You can't use app-level security 
to set the principal for a container-level security policy :(

If you want, you can implement a Filter that wraps your 
HttpServletRequest object with something you write yourself which does 
have this ability. Or, you can set the principal when you wrap the 
request...

-chris


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