Wildfly定制AUTH-方法 [英] Wildfly Custom auth-method

查看:212
本文介绍了Wildfly定制AUTH-方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何添加在Wildfly一个自定义的认证?我以前做这在JBoss中4.2:

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

在<$c$c><JBoss>\\jboss-as\\server\\production\\deploy\\jboss-web.deployer\\META-INF\\jboss-service.xml,添加以下的:

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

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

在<$c$c><JBoss>\\jboss-as\\server\\production\\deploy\\jboss-portal-ha.sar\\portal-server.war\\WEB-INF\\web.xml,修改:

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

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

Wildfly不具备的jboss-service.xml里了。

Wildfly does not have jboss-service.xml anymore.

推荐答案

我找到了答案。我们需要在META-INF /服务创建一个暗潮ServletExtension(io.u​​ndertow.servlet.ServletExtension)注册认证机制。我的扩展类看起来是这样的:

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

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:

You can now refer to this in your web.xml:

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

这篇关于Wildfly定制AUTH-方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆