Tomcat6 で DIGEST 認証

Tomcat6 で DIGEST 認証の設定

server.xml レルムのコメントをはずす。
  <!-- -->
  <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
         resourceName="UserDatabase"/>


tomcat-users.xml を編集、role と 認証する user を追加する

  <role rolename="Uranus"/>
  <user username="root" password="7fJklp2N" roles="Uranus"/>


Uranus アプリのweb.xml

   <resource-ref>
      <description>ctvdb DataSource</description>
      <res-ref-name>jdbc/uranusdb</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      <res-sharing-scope>Shareable</res-sharing-scope>
   </resource-ref>
   <resource-env-ref>

      <resource-env-ref-name>users</resource-env-ref-name>
      <resource-env-ref-type>org.apache.catalina.UserDatabase</resource-env-ref-type>
   </resource-env-ref>

   <security-constraint>

      <web-resource-collection>
         <web-resource-name>Uranus</web-resource-name>
         <url-pattern>/*</url-pattern>
      </web-resource-collection>
      <auth-constraint>
         <role-name>Jacob</role-name>
      </auth-constraint>
   </security-constraint>
   <login-config>

      <auth-method>DIGEST</auth-method>
      <realm-name>UserDatabaseRealm</realm-name>
   </login-config>
   <security-role>

      <role-name>Uranus</role-name>
   </security-role>

</web-app>