tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guido Schoepp <gus-apa...@guxx.net>
Subject Re: Why no GenericPrincipal?
Date Sat, 03 Jun 2006 11:23:46 GMT
Mh, is this not the right list for these kind of questions?

   Guido

Guido Schoepp schrieb:
> I set up a JSP to get the user principal. But when trying to access the 
> principal by
>   request.getUserPrincipal(),
> I'll always get a plain Principal class. I expected to get a 
> GenericPrincipal class by the container's UserDatabaseRealm.
> 
> I'm using the Tomcat default configuration with the UserDatabaseRealm. I 
> tried this with TC 5.0.27 on Windows 2000 and TC 5.0.28 on Debian Linux.
> 
> Any thoughts?
> 
>   Guido
> 
> --- authtest.jsp --------------
> <html>
> <body>
> <h1>AuthTest</h1>
> Name: <%=request.getRemoteUser()%><br/>
> <%
>   java.security.Principal principal = request.getUserPrincipal();
>   out.println("Principal Name: "+principal.getName()+"<br/>");
>   if (principal instanceof org.apache.catalina.realm.GenericPrincipal) {
>     org.apache.catalina.realm.GenericPrincipal gp =
>        (org.apache.catalina.realm.GenericPrincipal)principal;
>     out.println("Principal PW: "+gp.getPassword()+" <br/>");
>   } else {
>     out.println("no GenericPrincipal <br/>");
>   }
> %>
> </body>
> </html>
> --- authtest.jsp --------------
> 
> --- web.xml -------------------
>   ...
>   <security-constraint>
>     <display-name>Example Security Constraint</display-name>
>     <web-resource-collection>
>       <web-resource-name>Protected Area</web-resource-name>
>       <url-pattern>/*</url-pattern>
>     </web-resource-collection>
>     <auth-constraint>
>       <role-name>tomcat</role-name>
>     </auth-constraint>
>   </security-constraint>
> 
>   <security-role>
>     <role-name>tomcat</role-name>
>   </security-role>
> 
>   <login-config>
>     <auth-method>BASIC</auth-method>
>   </login-config>
>   ...
> --- web.xml -------------------


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message