You can specify a user credential for a map. With a user
credential on a map, you can have two users interacting with the same
data grid through a web application.
Procedure
- Set the user credential in the client.properties file.
credentialAuthentication=required
authenticationRetryCount=3
credentialGeneratorAssembly=IBM.WebSphere.Caching.CredentialGenerator, Version=8.6.0.0,
Culture=neutral, PublicKeyToken=b439a24ee43b0816
credentialGeneratorClass=IBM.WebSphere.Caching.Security.UserPasswordCredentialGenerator
credentialGeneratorProps=manager manager1
- Add a reference to the IBM.WebSphere.Caching.CredentialGenerator.dll file in your application project.
This plug-in DLL contains
the ICredentialGenerator implementation.
- Use the ICredentialGenerator APIs in
your .NET application.
//GridManagerFactory.GetGridManager
IGridManager gm = GridManagerFactory.GetGridManager();
//IGridManager.Connect
ICatalogDomainInfo cdi = gm.CatalogDomainManager.CreateCatalogDomainInfo(hostAndPort);
ctx = gm.Connect(cdi, "client.properties");
//IGridManager.GetGrid
IGrid grid = gm.GetGrid( ctx, "Grid");
ICredentialGenerator credGenManager = new UserPasswordCredentialGenerator("manager", "manager1");
ICredentialGenerator credGenOperator = new UserPasswordCredentialGenerator("operator", "operator1");
//IGrid.GetGridMap
IGridMapPessimisticAutoTx<Object, Object> gridMap1 =
grid.GetGridMapPessimisticAutoTx<Object, Object>("Map1", credGenManager);
IGridMapPessimisticAutoTx<Object, Object> gridMap2 =
grid.GetGridMapPessimisticAutoTx<Object, Object>("Map1", credGenOperator);