在GlassFish中,在编写JCA适配器时,有没有办法将匿名用户映射到EIS用户?

发布于 2024-12-22 16:41:06 字数 577 浏览 5 评论 0原文

我已经为遗留系统创建了自己的 JCA->EIS 适配器。我在连接到旧系统时无法进行身份验证。

这很难解释。在 GlassFish v3.1.1 中,创建并安装自己的 JCA 适配器后,会出现一个名为“Work Security Maps”的选项卡。这似乎是输入 EIS 系统用户名/密码的唯一位置。我想使用匿名(未经身份验证的)用户运行我的 EJB,但为了填写 EIS 密码,您似乎必须指定组或用户映射。

有没有办法让 JCA 适配器的所有调用都使用相同的用户名/密码访问 EIS 系统?

所需的行为类似于 JDBC 的工作方式。我的数据库有一个用户名/密码。我的应用程序注入了数据源,但我不必将当前用户映射到数据库用户。

编辑: 正如第一个答案中所讨论的,您可以使用配置属性来实现这一点。但是,我不认为根据 JCA 规范这是正确的方法。在 Websphere 中,您可以在调用 subject 时将 JAAS 凭证分配为“组件管理的身份验证别名”。

我似乎无法在 GlassFish 中执行此操作。如果你调用Subject.getPrivateCredentials(PasswordCredential.class),你会得到一组带有空字符串的凭据。

I've created my own JCA->EIS adapter for a legacy system. I'm having trouble authenticating while connecting to the old system.

This is fairly difficult to explain. In GlassFish v3.1.1, after you've created your own JCA adapter and installed it, there is a tab called "Work Security Maps." This seems to be the only location to enter a username/password for the EIS system. I would like to run my EJB with anonymous (unauthenticated) users, but in order to fill out the EIS password, it seems you have to specify a group or user mapping.

Is there way to just have all invocations of the JCA adapter hit the EIS system with the same username/password?

The desired behavior is similar to how JDBC works. I have one username/password for my database. My application is injected with a datasource, but I don't have to map the current user to the database user.

EDIT:
As discussed in the first answer, you can implement this with config-properties. However, I don't believe this is the correct way to do this according to the JCA specification. In Websphere, you can assign JAAS credential as a "Component Managed Authentication Alias" and when you call subject.

I can't seem to do this in GlassFish. If you call Subject.getPrivateCredentials(PasswordCredential.class) you get back a set of credentials with blank strings.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

江挽川 2024-12-29 16:41:06

在 JDBC RA(或我最近使用的 ActiveMQ RA)中,您可以在资源适配器属性(ra.xml 中的 config-property)中设置用户名和密码。您可能希望在资源适配器中以类似的方式实现它。

In JDBC RA (or ActiveMQ RA I used recently), you set username and password in resource adapter properties (config-property in ra.xml). You likely want to implement it in similar way in your resource adapter.

萤火眠眠 2024-12-29 16:41:06

事实证明,无需在 ra.xml 中使用 config-property 即可完成此操作。诀窍是,您必须使用 ejb-jar.xml。 GlassFish 中似乎存在一个错误,即基于纯注释的 EJB 不使用基于容器的身份验证。

我试图在 GlassFish jira 上记录一个错误,详细说明了这一点: http://java.net /jira/browse/GLASSFISH-18096

It turns out, it is very possible to do this without using config-property in ra.xml. The trick is, you have to use an ejb-jar.xml. There seems to be a bug in GlassFish where Pure annotation based EJBs do not use container based authentication.

I'm trying to get a bug logged over at GlassFish jira detailing this: http://java.net/jira/browse/GLASSFISH-18096

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文