Re: Password-protecting Anthill

Varban <[email protected]>
Newsgroups gmane.comp.java.anthill
Organization Urbancode
Message-ID <[email protected]>
Here is what works for me:

in the web.xml file at the end I only have this:

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

and my anthill.xml looks like this:

<Context path="/anthill" docBase="/code/idea/AnthillOS/dist/anthill.war"
	 debug="0" privileged="true" swallowOutput="true">
<Manager className="org.apache.catalina.session.PersistentManager"
saveOnRestart="false"/>
<ResourceLink name="users" global="UserDatabase"
                type="org.apache.catalina.UserDatabase"/>
</Context>


Now the resource link in there is the same the manager app uses to get to the 
tomcat-users.xml file and if you do not have this, there is this piece in the 
server.xml file for tomcat under the server settings:

<GlobalNamingResources>

    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved"
           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
          pathname="conf/tomcat-users.xml" />

  </GlobalNamingResources>


and this goes under the engine settings, but I am not sure if it is needed:

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

I guess that the server.xml parts should be in there already (this came with 
the tomcat installation). Once you have all that all you need is a user and 
the anthill role in the tomcat-users.xml file and tomcat restart.

Regards,
Varban
On Tuesday 28 February 2006 14:00, Andy Levy wrote:
> Well, I've managed to swing the pendulum to the opposite side.  I now
> get the BASIC authentication box, but it won't let me through.
>
> I deleted my previous attempts, then with the help of your link and
> the file you sent, I updated the web.xml in the WAR file with the
> following and put the new anthill.war into tomcat5\webapps (actually,
> most of it was there already, but commented out):
>
> <security-constraint>
> 		<web-resource-collection>
> 			<web-resource-name>anthill</web-resource-name>
> 			<url-pattern>/*</url-pattern>
> 		</web-resource-collection>
> 		<auth-constraint>
> 			<role-name>anthill</role-name>
> 		</auth-constraint>
> 	</security-constraint>
> 	<login-config>
> 		<auth-method>BASIC</auth-method>
> 		<realm-name>anthill</realm-name>
> 	</login-config>
>     <security-role>
>         <description>Role required to log in</description>
>         <role-name>anthill</role-name>
>     </security-role>
>
> tomcat-users.xml has a role called "anthill" and a user configured as
> well.  Another application (/manager - came w/ Tomcat 5) also uses the
> MemoryRealm for users and works properly; however, I struggled getting
> that one working until one day it just "worked" and I didn't know what
> I'd done.  I've restarted Tomcat, even rebooted, and can't get in.
> I'm not seeing anything in any of the logs that even hints at where to
> go next.
>
> On 2/28/06, Eric Minick <[email protected]> wrote:
> > Andy,
> >
> > There's nothing in the standard Anthill OS that supports basic
> > authentication, but I would think that if configured properly Tomcat
> > would ask for a password and send the role information to Anthill OS.
> > Anthill OS would ignore the role, but that's ok, Tomcat should be
> > managing general access.
> >
> > Also, I'm not sure if it's relevent or helpful, but there is a guide for
> > hooking the Pro version into LDAP. There might be some nuggets in that
> > guide that apply here: http://wiki.urbancode.com/home/LDAPIntegration
> >
> > Regards,
> > Eric
> >
> > Andy Levy wrote:
> > >Is is possible, without modifying anything in the standard Anthill
> > >distribution, to apply BASIC authentication to allow only selected
> > >individuals access to the application?
> > >
> > >I've been reading through the Tomcat 5 Realm Configuration HOWTO as
> > >well as an O'Reilly article on Tomcat configuration but can't seem to
> > >get it working.  I've added a role, user & password in
> > >tomcat-users.xml, configured a MemoryRealm and set up
> > >security-constraint and login-config in anthill.xml (created in
> > >conf\Catalina\localhost), but I still don't get prompted to log in.
> > >
> > >Have I missed something, or does the standard distribution of Anthill
> > >not provide for authenticating users before allowing them access to
> > >the app?
> > >_______________________________________________
> > >Anthill mailing list
> > >Anthill-IWHQxnLZ/[email protected]
> > >http://lists.urbancode.com/mailman/listinfo/anthill
> >
> > _______________________________________________
> > Anthill mailing list
> > Anthill-IWHQxnLZ/[email protected]
> > http://lists.urbancode.com/mailman/listinfo/anthill
>
> _______________________________________________
> Anthill mailing list
> Anthill-IWHQxnLZ/[email protected]
> http://lists.urbancode.com/mailman/listinfo/anthill
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.