03.05.2015 Views

IBM WebSphere V5.0 Security - CGISecurity

IBM WebSphere V5.0 Security - CGISecurity

IBM WebSphere V5.0 Security - CGISecurity

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Method signature<br />

Result getUsersForGroup(String<br />

group<strong>Security</strong>Name, int limit) throws<br />

NotImplementedException,<br />

EntryNotFoundException,<br />

CustomRegistryException,<br />

RemoteException<br />

public List getGroupsForUser(String<br />

user<strong>Security</strong>Name) throws<br />

EntryNotFoundException,<br />

CustomRegistryException,<br />

RemoteException<br />

Credential createCredential(String<br />

user<strong>Security</strong>Name) throws<br />

NotImplementedException,<br />

EntryNotFoundException,<br />

CustomRegistryException,<br />

RemoteException<br />

Use<br />

Gets a list of users in a group. The<br />

maximum number of users returned is<br />

defined by the limit argument.<br />

Gets all the groups the given user is a<br />

member of.<br />

Throws the NotImplementedException for<br />

this method.<br />

Sample custom registry<br />

The following section documents the implementation of a DB2 custom registry.<br />

The DB2 registry uses JDBC to communicate with the database. Although this<br />

registry was tested with DB2, it should be possible to modify it to work with other<br />

relational databases. The source code (DB2Registry.java) is shown below and is<br />

also included in the ITSOBank application, along with the database structure.<br />

Open the DB2Registry.java source in <strong>WebSphere</strong> Studio and check the<br />

comments in the source code. You will find all the required methods for the<br />

UserRegistry interface implemented. Look for the SQL queries in the code and<br />

see what each method does with the database,<br />

The DB2Registry.class file must be copied to a directory accessible by the<br />

application server, that is a directory that is in the application server’s classpath<br />

(for example, /lib). Alternatively, update the application<br />

server’s classpath to refer to the directory that contains the class file.<br />

A simple custom registry test utility that runs from the command line is included<br />

and can be used to test whether the custom registry is working as required. The<br />

tool allows the developer to be sure that the custom registry is functioning before<br />

configuring the application server to use it. The tool will ask for some user and<br />

group information and use this information to query the custom registry. It will<br />

Chapter 8. Programmatic security 189

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!