Red Hat NETSCAPE ENTERPRISE SERVER 6.0 - NSAPI PROGRAMMER GUIDE Guida Utente Pagina 251

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
Vedere la pagina 250
Developing Java Applications
7-11
Converting LoginContext to an Instance
Convert the LoginContext to an instance. The code is shown below.
LoginContext loginContext = new LoginContext("com.fujitsu.interstage.sso",
subject, myHandler);
Use the following arguments for conversion:
First argument
Login configuration file entry name. For login configuration file details, refer to Creating Login
Configuration File.
Second argument
Instance of a Subject object in which user authentication information set for successful
authentication is stored
Third argument
Instance created as described in Converting CallbackHandler to an Instance.
Note
For JDK1.3, java.lang.SecurityException may be generated if a Java application converts the
LoginContext simultaneously from two or more threads, so use JDK1.4 or synchronize the LoginContext
conversion items. The following is an example:
LoginContext loginContext = null;
synchronized (LoginContext.class) {
loginContext = new LoginContext("com.fujitsu.interstage.sso",
subject, myHandler);
}
Calling LoginContext Login Method
Authentication processing is executed by calling the LoginContext login method. LoginException or its
subclass is thrown in the login method. Catch a thrown LoginException or its subclass. This is shown
in the following example:
try{
loginContext.login();
return true;
}
catch(FailedLoginException ex){
System.out.println("Authenticate failed");
continue;
}
Vedere la pagina 250
1 2 ... 246 247 248 249 250 251 252 253 254 255 256 ... 331 332

Commenti su questo manuale

Nessun commento