这个项目(https://github.com/guofengzh/jaspi-on-jetty)是在jetty中使用geronimo-jaspi调用回jetty-jaspi模块进行身份验证的JASPI API的一个工作示例。在此示例中,Geronimo似乎提供了配置机制,而Jetty则提供了身份验证模块。
似乎可以选择表单、摘要或基本身份验证方法。对表单登录的快速测试显示它似乎能够正常运行。
Jaspi身份验证工厂在jetty-web.xml中设置如下:
<Set name="securityHandler">
<New class="org.eclipse.jetty.security.ConstraintSecurityHandler">
<Set name="loginService">
<New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
<Set name="name">JAASRealm</Set>
<Set name="loginModuleName">jaas</Set>
</New>
</Set>
<Set name="authenticatorFactory">
<New class="org.eclipse.jetty.security.jaspi.JaspiAuthenticatorFactory" />
</Set>
</New>
</Set>
jaspi配置文件通过pom.xml文件中的系统属性进行引用:
<systemProperty>
<name>org.apache.geronimo.jaspic.configurationFile</name>
<value>./conf/jaspi/form-test-jaspi-2.xml</value>
</systemProperty>
此外,您提到的jaspi库已作为依赖项添加到pom中,以及geronimo jaspi实现。
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jaspi</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.components</groupId>
<artifactId>geronimo-jaspi</artifactId>
<version>2.0.0</version>
</dependency>
我也无法找到该主题的文档。看起来jetty-jaspi模块不是标准启动选项之一,但可以添加到${jetty.home/lib/ext}目录中(请参见Jetty类加载)。