Wildhash Custom auth-method

How to add a custom authenticator in Wildfly? I used to do this in JBoss 4.2:

In <JBoss>\ jboss-as \ server \ production \ deploy \ jboss-web.deployer \ META-INF \ jboss-service.xml add the following to:

 <java:property>
      <java:key>MY-CUSTOM-AUTH</java:key>
      <java:value>com.test.MyCustomAuthenticator</java:value>
 </java:property>

In <JBoss>\ jboss-as \ server \ production \ deploy \ jboss-portal-ha.sar \ portal-server.war \ WEB-INF \ web.xml, change:

...
 <login-config>
      <auth-method>MY-CUSTOM-AUTH</auth-method>
...

Wildfly no longer has jboss-service.xml.

+4
source share
2 answers

I have found the answer. We need to create an Undertow ServletExtension (io.undertow.servlet.ServletExtension) in META-INF / services to register the authentication mechanism. My extension class is as follows:

public class NtlmServletExtension implements ServletExtension {
    @Override
    public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) {
        deploymentInfo.addAuthenticationMechanism("NTLM", new NtlmAuthenticationMechanism.Factory());
    }
}

: http://undertow.io/documentation/servlet/security.html

: https://github.com/dstraub/spnego-wildfly

web.xml:

...
 <login-config>
      <auth-method>NTLM</auth-method>
...
+11

All Articles