【问题标题】:Wildfly 16.0.0.Final and ejb-client connections with security realmWildfly 16.0.0.Final 和 ejb-client 与安全领域的连接
【发布时间】:2019-10-27 03:29:13
【问题描述】:

Wildfly 开发人员指南解释了 here 如何使用 Wildfly 特定属性设置 InitialContext

关于“Scoped EJB Client contexts”的部分outlines,您也可以将这些属性传递给InitialContext

Properties jndiPropsL = new Properties();
jndiPropsL.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
jndiPropsL.setProperty("endpoint.name", "client-endpoint");
jndiPropsL.setProperty("org.jboss.ejb.client.scoped.context", "true");
jndiPropsL.setProperty("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
jndiPropsL.setProperty("remote.connections", "default");
jndiPropsL.setProperty("remote.connection.default.host", jbossHost);
jndiPropsL.setProperty("remote.connection.default.port", remotingPort);
jndiPropsL.setProperty("remote.connection.default.protocol", "http-remoting");
jndiPropsL.setProperty("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
jndiPropsL.setProperty("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");

与此相反,Wildfly 安全指南解释了如何设置“安全”的 EJB 客户端连接:

Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
properties.put(Context.PROVIDER_URL, "remote+http://127.0.0.1:8080");
InitialContext context = new InitialContext(properties);

凭据通过wildfly-config.xml 文件传递​​。

如果我想要两个文档中的功能,即“安全”连接和范围上下文,我必须配置什么?我是否只需要提供两组属性,然后将主机和端口设置两次?

【问题讨论】:

    标签: java jboss ejb wildfly


    【解决方案1】:

    如“Wildfly Elytron 安全指南”(请参阅​​ here)中所述,以前作为 remote.connection.* 属性提供的大部分设置现在已替换为 wildfly-config.xml 中的专用部分。

    新的 XML 结构似乎不支持 remote.clusters 选项。因此,您必须将其作为属性提供给InitialContext

    Properties jndiPropsL = new Properties();
    jndiPropsL.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
    jndiPropsL.setProperty("remote.clusters", "ejb");
    

    与旧版本的 ejb-client 库相比,如果你真的使用集群,你只需要传递这个选项。为非 ha 设置设置此选项将导致连接尝试失败。

    【讨论】:

      猜你喜欢
      • 2018-11-06
      • 2020-12-25
      • 2015-12-05
      • 1970-01-01
      • 1970-01-01
      • 2019-10-28
      • 2015-12-03
      • 2015-10-29
      • 2014-02-08
      相关资源
      最近更新 更多