uCosminexus Application Server, EJB Container Functionality Guide

[Contents][Glossary][Index][Back][Next]

3.6.1 Preconditions for implementing security

Security is implemented in an EJB client application with the APIs that Cosminexus provides. This subsection describes the preconditions for implementing security and also describes how to implement security. For details on the functionality and syntax of APIs, see 4. APIs Used in the EJB Client Applications the uCosminexus Application Server API Reference Guide.

Before implementing security, make sure that the following preconditions are fulfilled:

Organization of this subsection
(1) Implementing security

(1) Implementing security

To implement security in an EJB client application:

  1. Import the package of the security API.
    To use the security API, import the following package:
    import com.hitachi.software.ejb.security.base.authentication.*
  2. Obtain the LoginInfoManager object.
    Obtain the LoginInfoManager object with the program that invokes the methods of the Enterprise Bean. To obtain the object, use the getLoginInfoManager method of the static method prepared for the LoginInfoManager object.
    LoginInfoManager lm = LoginInfoManager.getLoginInfoManager();
  3. Log in with the user name and password.
    After obtaining the LoginInfoManager object, invoke the login method.
    lm.login(username, password);
  4. Invoke the methods of the Enterprise Bean.
    After the successful execution of the login method, invoke the methods of the Enterprise Bean.
  5. Perform a logout.
    After the invocation of the Enterprise Bean methods is complete, log out from the J2EE server with the logout method.
    lm.logout();

Note
When implementing security in an EJB client application, you must add HiEJBClientStatic.jar in the class path and perform compilation.