ひとまず認証の勉強にTomcatのBasicについて試してみる。
が、
よくわからん。
. . . . . . . . . orz
以下の3つのファイルを書き換えたら動いたけど
正しいのか怪しいもんだわ。
にそれぞれ、
コンテキスト.xml
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" debug="0" resourceName="UserDatabase" /> <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" />
web.xml
以下の
<security-constraint> <web-resource-collection> <web-resource-name> Authentication of Basci Auth </web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>basic</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> <realm-name>UserDatabaseRealm</realm-name> </login-config>