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.

Running the client-side login sample<br />

To test the client-side login scenario, launch the ITSOBank J2EE client<br />

application from the command line. The client is packaged with all the application<br />

modules in the enterprise archive. Normally, you will only need the client<br />

application, the utility JARs, and some of the EJB classes for client access.<br />

launchclient itsobank_secured.ear [ stdin | gui | username password realm ]<br />

The following example launches the client using the character-based console to<br />

collect login information:<br />

launchclient itsobank_secured.ear stdin<br />

The following example launches the client passing the login information as<br />

parameters:<br />

launchclient itsobank_secured.ear manager01 password dirsrv:389<br />

If you are running the client from a remote terminal, you have to specify the<br />

server hostname and eventually the server port for the connection:<br />

launchclient -CCBootstrapHost=appsrv01 -CCBootstrapPort=2809<br />

itsobank_secured.ear<br />

Thin Java application<br />

The thin Java application also has to use a login mechanism to log in to the<br />

application server. <strong>WebSphere</strong> Application Server V5 supports JAAS as the<br />

authentication mechanism for programmatic login. In order to perform a login to<br />

access a remote EJB, you must do the following:<br />

1. Initialize the ORB for the CORBA connection. The following code snippet<br />

shows the ORB initialization.<br />

Example 8-8 ORB initialization<br />

...<br />

Properties props = new Properties();<br />

props.put("org.omg.CORBA.ORBClass", "com.ibm.CORBA.iiop.ORB");<br />

props.put("com.ibm.CORBA.ORBInitRef.NameService","corbaloc:iiop:" + serverName<br />

+ ":" + serverPort + "/NameService");<br />

props.put("com.ibm.CORBA.ORBInitRef.NameServiceServerRoot","corbaloc:iiop:"+<br />

serverName + ":" + serverPort + "/NameServiceServerRoot");<br />

ORB _orb = ORB.init((String[]) null, props);<br />

...<br />

2. Perform the programmatic login using JAAS; this part is very similar to the<br />

login process introduced before.<br />

3. Initialize the Context for the EJB lookup, then look up the EJB.<br />

4. Acquire the remote object through the EJB’s home interface.<br />

Chapter 8. Programmatic security 211

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

Saved successfully!

Ooh no, something went wrong!