Showing posts with label Websphere. Show all posts
Showing posts with label Websphere. Show all posts

Set up custom user registry in Websphere 6.1 Application Server

Websphere doesn't provide out of box feature of data base authentication. This is really annoying if you want your web/ear applications deployed in WAS to be authenticated against the relational databases such as oracle, sybase, etc. Interestingly weblogic provides very good feature of configuring SQL authentication provider with Relational Database. It uses data source to configure. I have myself configured & authenticated successfully with Oracle in Weblogic. More info on that in feature.

But Websphere you need to write custom code for SQL authentication. You cannot use other WebSphere Application Server components, for example, data sources, to initialize the custom registry because other components, like the containers, are initialized after security and are not available during the registry initialization. A custom registry implementation is a pure custom implementation, independent of other WebSphere Application Server components. confusing? thats the way it is.

So I have custom code which authenticates with Oracle. This works OK. Obviously I also need to create the database schema for storing user/group/role information.

I wont be able to publish the code on the internet. But I can share with anyone if they are interested.

Cheers...Happy Deploying..

Setting up authentication alias in Websphere 6.1 application server

When you deploy application in websphere which uses Websphere application server JDBC resources, there are number of different ways for specifying security credentials. The simplest way is mention the user name/password programmatically when creating connection in clear text format. Needless to say this is a bad idea as we hard code these credentials in our application. one better way is create a component-managed authentication alias. This involves creating a mapping from an alias name to the userid and password. This alias name is then specified administratively on the connection factory or data source.

Steps:
1. Go to websphere admin console
2. Under Security >> Secure administration, applications, and infrastructure >> JAAS >> J2C authentication data
3. Click New
4. Enter alias name
5. Enter Data base user id and password for connecting to database.
6. Click OK.

While creating data source for you application to connect to database, you should mention this alias name. So you can avoid entering clear text username/password while establishing connection in your application code.

Create authentication alias in Websphere Application Server

I was recently involved in setting up the infrastructure for deploying web applications into Websphere App Server(WAS) v6.1. As a "weblogic bee", this is was something new to me. But over all, the experience was really great.

The tasks involved in the whole process is given below:
1) Installation of WAS6.1
2) Creating profile called appProfile using Profile Management Tool (in weblogic we create "domains" using domain config wizard)
3) Started the profile
4) Created connection pools, data sources
5) Resource reference mapping.
6) Implement custom user registry.
7) Deploy Web applications.
8) Map security role to user/group mapping.

After doing all of the above tasks, application would not connect to Data base using data source connection. It was throwing exceptions in the logs. It took couple of days to figure it out Websphere needs user name/password while creating connection. So login credentials can be passed

a) programmatically but this is a bad idea as hard coding user id/password in the application code.
b) create authentication alias mapping to a user name/password in websphere admin console

So this alias name must be mapped while creating data source itself..

ooooph! Finally it worked.

P.S: 
If you don't create an alias while establishing connection using data source in Websphere 6.1 you may end up getting this error below: 
Authentication Alias Websphere JNDI Data source Exception Connection Failed SQLException null userid is not supported. errorcode 4461