Realm name in tomcat (web.xml)

Krishna picture Krishna · Jun 5, 2012 · Viewed 22k times · Source

What is the realm-name in the tomcat.

<login-config> 
     <auth-method>BASIC</auth-method> 
     <realm-name></realm-name> 
</login-config>

In the above code I have to fill the realm-name element. I have seen the following code in the server.xml file:

<Realm className="org.apache.catalina.realm.UserDatabaseRealm" 
            resourceName="UserDatabase"/>

Where is the realm-name specified? Is it the user name?

Answer

stevedbrown picture stevedbrown · Jun 5, 2012

Realm name is not the user name. It is the authentication realm, 'typically a description of the computer or system being accessed" - see http://en.wikipedia.org/wiki/Basic_access_authentication. This should be name that makes sense for the resource you are protecting.