⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mailsystem.java

📁 SSO客户端
💻 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);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -