You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Mudumbai, Kalyan" <Ka...@gs.com> on 2005/03/29 01:05:40 UTC

BASIC Authentication for Custom Realm

Hi All,

I am trying to write a custom realm for my web application. I have added the
realm in the sever.xml file as below:

<Realm className="com.web.tomcat.security.CustomRealm" debug="0"/>

and I had the following entries in my web.xml file.

 	<security-constraint>
                <web-resource-collection>
                        <web-resource-name>webfiles</web-resource-name>
                        <url-pattern>/*</url-pattern>
                </web-resource-collection>
                <auth-constraint>
                        <role-name>everyone</role-name>
                </auth-constraint>
        </security-constraint>
        <login-config>
        	<auth-method>BASIC</auth-method>
                <realm-name>CustomRealm</realm-name>
        </login-config>
        <security-role>
                <role-name>everyone</role-name>
        </security-role>

When I access a page in my app, I'm expecting to get a Login Dialog box
that's provided by the web browser. But it doesn't happen, when I try to
access a web page.
If I remove my custom realm entry in the server.xml, the login dialog
appears. Has the appearance of the Login Dialog got to do anything with the
Realm? 

Can someone please let me know what's going wrong here?

Thanks,
Kalyan.

Re: BASIC Authentication for Custom Realm

Posted by Mark Thomas <ma...@apache.org>.
Based on my own experience, the quickest way to work out what is 
happening will be to debug your way through it. See the FAQ for how to 
set this up: http://jakarta.apache.org/tomcat/faq/development.html

Mark

Mudumbai, Kalyan wrote:
> Hi All,
> 
> I am trying to write a custom realm for my web application. I have added the
> realm in the sever.xml file as below:
> 
> <Realm className="com.web.tomcat.security.CustomRealm" debug="0"/>
> 
> and I had the following entries in my web.xml file.
> 
>  	<security-constraint>
>                 <web-resource-collection>
>                         <web-resource-name>webfiles</web-resource-name>
>                         <url-pattern>/*</url-pattern>
>                 </web-resource-collection>
>                 <auth-constraint>
>                         <role-name>everyone</role-name>
>                 </auth-constraint>
>         </security-constraint>
>         <login-config>
>         	<auth-method>BASIC</auth-method>
>                 <realm-name>CustomRealm</realm-name>
>         </login-config>
>         <security-role>
>                 <role-name>everyone</role-name>
>         </security-role>
> 
> When I access a page in my app, I'm expecting to get a Login Dialog box
> that's provided by the web browser. But it doesn't happen, when I try to
> access a web page.
> If I remove my custom realm entry in the server.xml, the login dialog
> appears. Has the appearance of the Login Dialog got to do anything with the
> Realm? 
> 
> Can someone please let me know what's going wrong here?
> 
> Thanks,
> Kalyan.
> 


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