jettyでのBASIC認証の設定。
サーブレット・コンテナ上でのBASIC認証等の設定は、どのサーブレットでも共通な部分と、jettyやtomcat等、特有な部分があり、その両方を設定しなければならない。
共通な部分
これは、web.xmlファイルに、admin page /admin/* admin NONE BASIC admin admin
Jettyに特有な設定
Jettyの設定ファイル「jetty.xml」に以下を追加して、realm.propertiesファイルを使うように宣言する。admin /usr/local/jetty/etc/realm.properties admin
realm.propertiesファイルの内容は、、、
# This is a HashUserRealm defining users passwords and roles. # The format is #: [, ...] # # Passwords may be clear text, obfuscated or checksummed. The class # org.mortbay.util.Password should be used to generate obfuscated # passwords or password checksums admin: AdminPasswd, admin
で、ユーザー名、パスワード、ロール名、を羅列する。
参考URL
- 「web.xml 要素リファレンス」の「付録(コラム) 」
http://www.sk-jp.com/java/servlet/webxml.html#h111
http://www2s.biglobe.ne.jp/~yuuki_ki/opensource/js_tomcat9.htm