tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: parameters
Date Wed, 14 Nov 2001 18:00:31 GMT


On Wed, 14 Nov 2001, Bongiorno, Christian wrote:

> Date: Wed, 14 Nov 2001 12:59:06 -0500
> From: "Bongiorno, Christian" <Bongiorno.Christian@ensco.com>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: 'Tomcat Users List' <tomcat-user@jakarta.apache.org>
> Subject: parameters
>
> I am pretty sure that this is true, but just to get a sanity check,
> do the username and password come in as parameters to the servlet as part of
> the ServletRequest?
>

In general the answer is "no", but it depends on which login method you
are using.  For BASIC authentication, they come in as part of the
"Authorization" header, in accordance with the requirements of HTTP (see
RFC 2617 for more info -- you can use the search engine at
<http://www.rfc-editor.org> to find it).

Once the user has been authenticated, you have access to the following
methods at the application level:
* request.getRemoteUser() returns the username
* request.getUserPrincipal() returna a java.security.Principal
  object for the authenticated user
* request.isUserInRole() lets you ask if the currently logged in
  user has a particular security role.

Note that the password is not visible through these APIs.  That is
appropriate, because you don't need it if you are letting the container
manage logins -- all you care about is whether the user has been
authenticated or not.

Craig


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message