InfoCenter Home >
5: Securing applications -- special topics >
5.7: The Secure Association Service (SAS) >
5.7.6: Introduction to SAS programming >
5.7.6.1: Getting a reference to a Current object

5.7.6.1: Getting a reference to a Current object

The Current class contains an implementation of the CORBA SecurityLevel2 Current object. The class provides access to security-level 2 function as defined in the Object Management Group (OMG) CORBA Security Service specification.

A Current object allows you to obtain or manipulate the credentials that you want to use in your program. You can obtain a Current object in either the client or the server. However, you can only get a Current object if the Security Service run time has been installed and the ORB has been initialized.

To obtain a Current object, using following steps:

  1. Obtain a reference to the com.ibm.CORBA.iiop.ORB object. You can obtain a reference to the com.ibm.CORBA.iiop.ORB object by invoking the com.ibm.ejs.oa.EJSORB.getORBInstance() method, which is static.
  2. Create a reference to the org.omg.SecurityLevel2.Current object, and then use the ORB.resolve_initial_references method to get access to the security Current object. Pass the string "SecurityCurren to the resolve_initial_references method.

Code sample: obtaining a Current object

...
// Get the current ORB instance.
com.ibm.CORBA.iiop.ORB orb = com.ibm.ejs.oa.EJSORB.getORBInstance();

// Get the security Current object.
if (orb != null)
org.omg.SecurityLevel2.Current securityCurrent =
(org.omg.SecurityLevel2.Current)orb.resolve_initial_references("SecurityCurrent");

if (securityCurrent == null)
System.out.println("Security has not been initialized");
...
Go to previous article: SAS Programming Introduction Go to next article: SAS Programming/Credentials

 

 
Go to previous article: SAS Programming Introduction Go to next article: SAS Programming/Credentials