↓ Skip to main content

Authentication aliases

·3 mins

I had a couple of questions last week relating to authentication aliases. When using WebSphere Application Server resources built on the JCA support, including JDBC data sources and JMS connection factories, there are a number of different mechanisms for specifying security credentials.

The simplest mechanism is to specify a username and password programmatically when creating a connection. Generally this is a bad idea as it involves hardcoding these credentials in to the application. The next option is to specify the username and password directly on the connection factory or data source when defining it administratively. This removes them from the application but means that any application with access to the JNDI namespace, whether it is running in the server or not, can retrieve the resource and create an authenticated connection.

Another option is to use a component-managed authentication alias. This involves creating a mapping from an alias name to the username and password. This alias name is then specified administratively on the connection factory or data source. As the alias can only be resolved in the application server, this restricts authenticated access to applications running in the application server.

One step better still is to use a container-managed authentication alias. This works in much the same way as the component-managed alias but the connection factory or data source needs to be looked up via a resource-reference that specifies a res-auth of Container. As a consequence, for an application to retrieve the authenticated resource, the administrator must have explicitly bound the resource-reference to the resource on deployment of the application.

The final option, which only became available in WebSphere Application Server Version 6, is to use a container-managed authentication alias but, rather than specify the alias on the connection factory or data source, the alias can be defined on the resource-reference itself. This means that only that application can retrieve the resource and create a connection with those associated credentials. There is one gotcha with this approach which was the source of the two questions I recieved: if you create an alias via the administrative console, it is prefixed with the name of the node via which the alias was created. Consequently, if you want to specify this alias name in your application you end up with a dependency on the deployment environment.

The thinking was that, if you created an alias on a standalone server and then federated it in to a cell, this approach would avoid naming collisions. Now, IMHO, it would have been preferable just to omit warnings on the federation or some such approach. Anyway, to avoid this issue, create the aliases via wsadmin as the prefix is then not added. The InfoCenter covers how to achieve this in Jacl or Jython.

Related

J2EE newbies

·1 min
Whilst the majority of the customers I deal with are well versed in the ways of WebSphere, just occasionally I come across one that is not only new to WebSphere but also to the world of J2EE. In the past I have struggled to suggest suitable reading material, often resorting to the Sun J2EE tutorial as a starting point. Now Charlie Brown (who, as he hastens to point out, does have a beagle but not called Snoopy) has written an excellent introduction to J2EE the WebSphere way entitled “Experience J2EE! Using WebSphere Application Server V6.1”. It’s currently only a draft but, having taken a look at the messaging section, it’s well written and informative. There is even a chapter covering the, to my mind, advanced topic of importing a subject on to a message-driven bean’s thread using the credentials passed in a message. Be sure to rate the book so that we can ensure that Charlie’s good work can continue.

developerWorks roundup

This is my usual weekly roundup of what’s new and interesting on developerWorks. This week we start with something for the WebSphere Application Server developer. When abstracting configuration properties out of code they often end up in a simple properties file. This is fine if the values are static but, if they need updating, you either need to redeploy the application containing the file or else put the file somewhere separate from the application. (If taking the latter approach then the config directory is a good place for the file as then you call leave the application server to replicate it across the nodes.) Perhaps a better approach is to configure a resource environment provider as described in this article, enabling properties to be defined administratively.

High availability of WebSphere MQ link

Today sees the release of WebSphere MQ SupportPac MR01. This provides the source for a WebSphere MQ channel exit which can be configured with a list of host names and port numbers to which the channel will attempt to connect. The intention is that this exit can be used when using a WebSphere MQ link to connect a clustered Service Integration Bus messaging engine to a queue manager. The messaging engine can now failover to another cluster member and the queue manager will still be able to connect.