This directory contains the source programs implementing the Sample Provider 
for testing the UserIdentity change from inside the provider method.

CIMOMHandle Testcase Sample Provider
------------------------------------

The provider calling the CIMOMHandle sets a UserIdentity into the 
OperationContext. It is possible for a provider to call the CIMOMHandle with a 
user name that is different than the end-user on the client who sent in the 
original request.For example, a provider could set "root" into the 
UserIdentity, effectively promoting itself to root authority when calling the 
CIMOMHandle. Nothing in the current Pegasus design checks the authority of the
caller to CIMOMHandle, so having this testcase now would be to set up for the 
future.

Provider Module Name = CIMOMSampleProviderModule
Provider Class = CIMOMSampleProviderClass

Scripts
-------

1. rebuild

This script performs the following operations:
Cleaning the provider lib., provider compilation, populating the repository,
provider registration, and finally restarting the cimserver.

2. clitests <Auth-Flag>

It runs the CLI command for the following CIM operations without any kind of
namespace authorization: [By Default its NoAuth execution]
enumerateInstances, 
enumerateInstanceNames, 
enumerateClasses, 
enumerateClassNames

If its invoked as: clitests 1	(The arg. 1 is nothing but to tell the script
that I need authentication to be enabled and namespace authorization to be
enbaled)
It runs the CLI command for the following CIM operations, with the different 
combinations of valid and invalid users (specifying user= and password=)
enumerateInstances, 
enumerateInstanceNames, 
enumerateClasses, 
enumerateClassNames

3. cli_select
CLI is run for different users authentication and user specifies CIM operation
to be executed, as an argument to the script.

CIMOMHandle Authentication Test [when Namespace authorization is enabled]
-------------------------------

The following commands were run to check the authentication while running the
CLI test program. There are 2 users who are given the 'read' permission for the
namespace root/SampleProvider by running the following:

cimauth -a subodh -n root/SampleProvider 
cimauth -a guest -n root/SampleProvider

Pre-requisites: 
1. The user for whom authentication is being added should be a valid CIM user 
   [added by running cimuser -a .....]
2. The configuration parameter "enableAuthentication" should be set to TRUE. 
   If we restart cimserver after configuring it for no authentication all the 
   following cases will execute successfully
   [run "cimserver enableAuthentication=true]

The results of running testclient "CLI enumerateinstances" on the CIMOMSample 
Class are:

#1. CLI ni -n root/SampleProvider CIMOMSample

Output: 
CLI Pegasus Exception: Authentication failed.. Cmd = ni Object = CIMOMSample
Reason:
[No user information]

#2. CLI ni -n root/SampleProvider CIMOMSample -u subodh -p soni

Output: 
Entry to CIMOMSampleProvider
 CIMOMSampleProvider::initialize
 CIMOMSampleProvider::enumerateInstanceNames
 className = CIMOMSample
 CIMOMSample.Id=187
Reason: [User name and password valid]

#3. CLI ni -n root/SampleProvider CIMOMSample -u guest -p guest

Output:
 Entry to CIMOMSampleProvider
  CIMOMSampleProvider::initialize
  CIMOMSampleProvider::enumerateInstanceNames
  className = CIMOMSample
  CIMOMSample.Id=187
Reason: [User name and password valid]

#4. CLI ni -n root/SampleProvider CIMOMSample -u guest -p nothing

Output:
CLI Pegasus Exception: Authentication failed.. Cmd = ni Object = CIMOMSample
Reason: [User name is valid but password is wrong]

Miscellaneous
-------------
Logfiles for all the cim operations executed are also generated. The naming
convention of the log files is <CIM Operation abbr>-auth.log (for example 
ni-auth.log).
The file "expected.out" contains the correct results on test being successful.
