In GlassFish, while writing a JCA adapter, is there a way to map anonymous users to an EIS user?

StackOverflow https://stackoverflow.com/questions/8592178

سؤال

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.

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top