IllegalStateException:FormAuthenticator 码头没有登录服务
IllegalStateException: No LoginService for FormAuthenticator Jetty
我正在 Jetty 中配置自定义 JAAS 登录模块。
import org.eclipse.jetty.jaas.spi.AbstractLoginModule;
public class HybridLoginModule extends AbstractLoginModule
我将文件添加到:jetty-9.4.8/etc/login.conf
hybridRealm {
net.sf.jkniv.jaas.jetty.HybridLoginModule required
}
在以下位置启用 jaas:jetty-9.4.8/start.ini
--module=jaas
jetty.jaas.login.conf=etc/login.conf
并在 jetty-9.4.8/etc/jetty-webapp.xml
中配置 JAAS JAASLoginService
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.jaas.JAASLoginService">
<Set name="name">Hybrid JAAS Realm</Set>
<Set name="LoginModuleName">hybridRealm</Set>
</New>
</Arg>
</Call>
但是当我启动码头服务器时java -jar start.jar
抛出异常
IllegalStateException:FormAuthenticator 没有登录服务
java.lang.IllegalStateException: No LoginService for org.eclipse.jetty.security.authentication.FormAuthenticator@25084a1e in org.eclipse.jetty.security.ConstraintSecurityHandler@156b88f5
at org.eclipse.jetty.security.authentication.LoginAuthenticator.setConfiguration(LoginAuthenticator.java:76)
at org.eclipse.jetty.security.authentication.FormAuthenticator.setConfiguration(FormAuthenticator.java:131)
The jetty documentation it's ambiguous,要解决配置问题,请将 web.xml 文件中的 realm-name
属性 设置为与 <Set name="Name">
财产,没有 <Set name="LoginModuleName">
.
web.xml 文件:
<realm-name>xyzREALM</realm-name>
jetty-webapp.xml 文件:
<New class="org.eclipse.jetty.jaas.JAASLoginService">
<Set name="Name">xyzREALM</Set>
<Set name="LoginModuleName">hybridRealm</Set>
</New>
我正在 Jetty 中配置自定义 JAAS 登录模块。
import org.eclipse.jetty.jaas.spi.AbstractLoginModule;
public class HybridLoginModule extends AbstractLoginModule
我将文件添加到:jetty-9.4.8/etc/login.conf
hybridRealm {
net.sf.jkniv.jaas.jetty.HybridLoginModule required
}
在以下位置启用 jaas:jetty-9.4.8/start.ini
--module=jaas
jetty.jaas.login.conf=etc/login.conf
并在 jetty-9.4.8/etc/jetty-webapp.xml
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.jaas.JAASLoginService">
<Set name="name">Hybrid JAAS Realm</Set>
<Set name="LoginModuleName">hybridRealm</Set>
</New>
</Arg>
</Call>
但是当我启动码头服务器时java -jar start.jar
抛出异常
IllegalStateException:FormAuthenticator 没有登录服务
java.lang.IllegalStateException: No LoginService for org.eclipse.jetty.security.authentication.FormAuthenticator@25084a1e in org.eclipse.jetty.security.ConstraintSecurityHandler@156b88f5
at org.eclipse.jetty.security.authentication.LoginAuthenticator.setConfiguration(LoginAuthenticator.java:76)
at org.eclipse.jetty.security.authentication.FormAuthenticator.setConfiguration(FormAuthenticator.java:131)
realm-name
属性 设置为与 <Set name="Name">
财产,没有 <Set name="LoginModuleName">
.
web.xml 文件:
<realm-name>xyzREALM</realm-name>
jetty-webapp.xml 文件:
<New class="org.eclipse.jetty.jaas.JAASLoginService">
<Set name="Name">xyzREALM</Set>
<Set name="LoginModuleName">hybridRealm</Set>
</New>