import com.hitachi.software.ejb.security.base.authentication.*;
:
try {
LoginInfoManager lm = LoginInfoManager.getLoginInfoManager();
String userName = System.getProperty("username");
String password = System.getProperty("password");
if(lm.login(userName , password)) {
try {
System.out.println("user:" + userName + "login success");
Context ctx = new InitialContext();
java.lang.Object obj = ctx.lookup(appUnitPath + "Account");
AccountHome aHome =
(AccountHome)PortableRemoteObject.narrow(obj,AccountHome.class);
Account account = aHome.create();
account.getAccountID();
} finally {
lm.logout();
}
}
} catch(NotFoundServerException e) {
System.out.println("not found server");
} catch(InvalidUserNameException e) {
System.out.println("invalid user name");
} catch(InvalidPasswordException e) {
System.out.println("invalid password");
} catch(Exception e) {
e.printStackTrace();
} |