How to use JASPI / JASPIC on Jetty?

The Jetty project homepage mentions JASPI compatibility (JASPIC / JSR 196).

However, the Jetty 8 distribution does not seem to contain JASPI-related classes. There jetty-security-8.1.8.v20121106.jar jar in [jetty home] / lib, but this one does not contain any JASPIC / JASPI types.

The JASPIC / JASPI documentation on the Jetty wiki is only a placeholder and does not contain any information.

After some Googling, I found JavaDocs on the Eclipse website and found that there should be jetty-jaspi-8.1.8.v20121106.jar somewhere . These JavaDocs are also included in the distribution. Finally, a jetty-jaspi repo message appears on Github.

Obviously, there is some support, but why are these classes apparently missing from the Jetty distribution, and where is the documentation on how to configure this? What am I missing?

+6
source share
1 answer

This project (https://github.com/guofengzh/jaspi-on-jetty) is a working example of a JASPI API in a jetty that uses geronimo-jaspi , which in turn accesses jetty-jaspi modules for authentication. In this example, Geronimo seems to provide a configuration mechanism and attaches the authentication modules themselves.

It seems that you can choose a form, digest, or basic authentication methods. A quick form-based login check showed that it was functioning.

Jaspi factory authentication is configured in the jetty-web.xml file as follows:

 <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> 

And the jaspi configuration file is referenced through the system property in the pom.xml file:

 <systemProperty> <name>org.apache.geronimo.jaspic.configurationFile</name> <value>./conf/jaspi/form-test-jaspi-2.xml</value> </systemProperty> 

In addition, the jaspi library you specify is added as a dependency in pom, as well as the implementation of 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> 

I also could not find the documentation on this topic. It seems that the jetty-jaspi module is not one of the standard launch options but can be added to $ {jetty.home / lib / ext} (see Jetty classloading ).

+8
source

All Articles