?? mailsystem.java
字號:
/*
* Main.java
*
* Created on 2006年1月23日, 下午3:58
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package desktopsso;
import java.io.*;
import java.security.*;
import javax.security.auth.*;
import javax.security.auth.callback.*;
import javax.security.auth.login.*;
import desktopsso.share.*;
/**
*
* @author wangyu
*/
public class MailSystem {
static LoginContext lc = null;
public static void main( String[] args) throws IOException{
// Create a login context
try {
lc = new LoginContext("DesktopSSO",new WangYuCallBackHandler());
} catch (LoginException le) {
System.out.println( "Login Context Creation Error" );
System.exit(1);
}
// Login
try {
lc.login();
} catch (LoginException le) {
System.out.println( "\nOVERALL AUTHENTICATION FAILED\n" );
le.printStackTrace();
System.exit(1);
}
System.out.println( "\nWelcome" );
System.out.println( lc.getSubject()+"\n" );
System.out.print( "You have a mail from Gary, Do you want to read? ");
System.out.flush();
String answer = new BufferedReader(new InputStreamReader(System.in)).readLine();
if (answer.substring(0,1).equalsIgnoreCase("y")) {
System.out.println("\n\n\nYou have done a great job! ");
System.out.println("Congratulations!");
System.out.println("Your Salary will be increases by 50% next month!");
}
try {
lc.logout();
} catch (LoginException le) {
System.out.println( "Logout FAILED" );
System.exit(1);
}
System.exit(0);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -