Unfortunately, there wasn't nothing much about using http-basic authentication as a login method when using Jetty, so here's some tips for that. These were done with Jetty 6.8.
First, follow the basic instructions. Then uncompress gerrit.war to Jettys /webapps, make sure that it goes gerrit -directory.
Add following to WEB-INF/web.xml under gerrit -directory, I added these to the top of the file.
<security-constraint> <web-resource-collection> <web-resource-name>A Protected Page</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>gerrit_user</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> <realm-name>GerritRealm</realm-name> </login-config>
Add following lines into gerrit.xml in Jetty's contexts -directory:
<get name="securityHandler"> <set name="userRealm"> <new class="org.mortbay.jetty.security.HashUserRealm"> <set name="name">GerritRealm</set> <set name="config"><systemproperty default="." name="jetty.home">/etc/gerritrealm.properties</systemproperty></set> </new> </set> </get>
Finally, create gerritrealm.properties into Jetty's etc/ and check etc/realm.properties for help. Passwords can be created by using the following command:
java -cp lib/jetty-xxx.jar:lib/jetty-util-xxx.jar org.mortbay.jetty.security.Password
Ei kommentteja :
Lähetä kommentti