I previously had some code working on Glassfish, but I want to port it to WildFly.
However, I cannot seem get the module to be invoked by WildFly. The ServletContextListener
initializes the module as follows
AuthConfigFactory.getFactory() .registerConfigProvider(new OpenIdConnectModuleConfigProvider(options, null), "HttpServlet", getAppContext(sce), null);
"HttpServlet"
is not Glassfish specific and appears to be referenced in https://github.com/wildfly/wildfly/blob/master/undertow/src/main/java/org/wildfly/extension/undertow/security/jaspi/JASPIAuthenticationMechanism.java?source=cc
Glassfish does not require a <logon-config>
block on the web.xml
and putting any variant in WildFly does not work (as expected)
The other place I am suspecting is how I calculate the application context identifier. For Glassfish I had
private String getAppContext(final ServletContextEvent sce) {
return sce.getServletContext()
.getVirtualServerName() + " "
+ sce.getServletContext()
.getContextPath();
}
Could it be different in WildFly? Though I saw the similar code in https://github.com/rdebusscher/secSpikeWeb/blob/master/src/main/java/org/omnifaces/security/jaspic/core/Jaspic.java#L300 as well
I have also tried adding to standalone.xml
this block
<security-domain name="jaspi" cache-type="default">
<authentication-jaspi>
<login-module-stack name="dummy">
<login-module code="Dummy" flag="optional"/>
</login-module-stack>
<auth-module code="org.wildfly.extension.undertow.security.jaspi.modules.HTTPSchemeServerAuthModule" flag="required"/>
</authentication-jaspi>
</security-domain>
And set <default-security-domain value="jaspi"/>
However it had no effect and putting a breakpoint in the module didn't show that it gets hit either.
In addition, there I couldn't find a to be a way of doing the following, in WildFly like I would in glassfish-web.xml
but that can be another question
<security-role-mapping>
<role-name>users</role-name>
<group-name>https://helloworld</group-name>
</security-role-mapping>
The code is pretty big, but the gist of it can be found in
https://github.com/trajano/openid-connect/tree/openid-connect-1.0.1/openid-connect-jaspic-module
and
https://github.com/trajano/openid-connect/tree/openid-connect-1.0.1/openid-connect-jaspic-sample
Note I am looking for it on the application level and not set a global server JASPI.