客先から「192.168.1.134にdiget認証のrelmsを作成してください」と
相変わらずわけわかんない指令を受けたので、
「何かに使う『digest』認証を任意の『Realm』で設定」
と解釈して取り組みました。
一番簡単なFileRealmでいいっしょ、
これは4848のGUIからRealms辿ってManage Usersボタンからuser足せばいいし、
Digest Authは<auth-method>DIGEST</auth-method>で瞬殺、
とか思ってたら、ハマりました。
index.htmlとweb.xmlのみの最小構成でproof application作ったのですが、
どうしても認証できないのです。
server.log見ると、
SEC1105: A PasswordCredential was required but not provided.
WEB9102: Web Login Failed: com.sun.enterprise.security.auth.login.common.LoginException: Login failed: unable to instantiate LoginModule: null
<?xml version="1.0" encoding="UTF-8" ?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<security-constraint>
<web-resource-collection>
<web-resource-name>Digest Authentication Test</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>someRole</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>DIGEST</auth-method>
<realm-name>someCreatedRealmUsingjdbcDigestRealmOnJAASContext</realm-name>
</login-config>
<security-role>
<role-name>someRole</role-name>
</security-role>
</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN"
"http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<security-role-mapping>
<role-name>user</role-name>
<group-name>user</group-name>
</security-role-mapping>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>.</description>
</property>
</jsp-config>
</glassfish-web-app>