I have to write a custom Jaspic ServerAuthModule (which needs to add a proprietary Authentication Cookie to the HTTP Response AND HTTP Request to be propagated to the applications running on the App Server). The Authentication must be done using Kerberos, SPNEGO.
The Application Server to be used is JBOSS EAP 6.4.x
I managed to get the Authentication using the JAAS Krb5LoginModule working.
The JBOSS EAP Standone.xml I use:
<security-domain name="host" cache-type="default">
<authentication>
<login-module code="com.sun.security.auth.module.Krb5LoginModule" flag="required">
<module-option name="debug" value="true"/>
<module-option name="principal" value="HTTP/[email protected]"/>
<module-option name="storeKey" value="true"/>
<module-option name="useKeyTab" value="true"/>
<module-option name="doNotPrompt" value="true"/>
<module-option name="keyTab" value="/Users/jet/Downloads/kerberos/macbookAirRCH.keytab"/>
</login-module>
</authentication>
</security-domain>
<security-domain name="SPNEGO" cache-type="default">
<authentication>
<login-module code="SPNEGO" flag="required">
<module-option name="serverSecurityDomain" value="host"/>
</login-module>
</authentication>
<mapping>
<mapping-module code="SimpleRoles" type="role">
<module-option name="[email protected]" value="User,Admin"/>
</mapping-module>
</mapping>
</security-domain>
jboss-web.xml:
<jboss-web>
<security-domain>SPNEGO</security-domain>
<valve>
<class-name>org.jboss.security.negotiation.NegotiationAuthenticator</class-name>
</valve>
<context-root>kerberosREST</context-root>
</jboss-web>
I also managed to get a customized JASPI Module working (extends org.jboss.as.web.security.jaspi.modules.WebServerAuthModule) using the following configuration:
<security-domain name="testDomain" cache-type="default">
<authentication-jaspi>
<login-module-stack name="lm-stack">
<login-module code="SPNEGO" flag="required">
<module-option name="serverSecurityDomain" value="host"/>
</login-module>
</login-module-stack>
<auth-module code="ch.test.jaspic.CustomServerAuthModule" flag="required" login-module-stack-ref="lm-stack"/>
</authentication-jaspi>
<mapping>
<mapping-module code="SimpleRoles" type="role">
<module-option name="[email protected]" value="User,Admin"/>
</mapping-module>
</mapping>
</security-domain>
jboss-web.xml:
<jboss-web>
<security-domain>testDomain</security-domain>
<valve>
<class-name>org.jboss.as.web.security.jaspi.WebJASPIAuthenticator</class-name>
</valve>
<context-root>kerberosREST</context-root>
</jboss-web>
How can I use the default JAAS Krb5LoginModule?
Should I include the two valves in the jboss-web.xml? (the order is important)
jboss-web.xml:
<jboss-web>
<security-domain>testDomain</security-domain>
<valve>
<class-name>org.jboss.security.negotiation.NegotiationAuthenticator</class-name>
</valve>
<valve>
<class-name>org.jboss.as.web.security.jaspi.WebJASPIAuthenticator</class-name>
</valve>
<context-root>kerberosREST</context-root>
</jboss-web>
Many thanks in advance
Unfortunately JASPIC isn't implemented very well on this version of JBoss. JBoss EAP 7 will be fine and should be released (if all goes well) this year or perhaps early next year (but nobody knows, not even the people at JBoss). There are several betas of EAP 7 out, the latest one is called JBoss WildFly 10 and a slightly earlier is called EAP 7 beta 1.
In general, there's a JAAS bridge where you let your JASPIC SAM call your JAAS Login Module. You need to understand that a JASPIC SAM is the authentication mechanism and the JAAS Login Module is the identity store.
I'm pretty sure you do not need the JBoss specific configuration of the JAAS Login Module. That is only needed to let JBoss internal code (e.g. their implementation of the Servlet FORM authentication mechanism) find that module.
If JASPIC is used, the SAM is in control.
For the bridge profile, see this article for more info:
https://blogs.oracle.com/nasradu8/entry/loginmodule_bridge_profile_jaspic_in