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

📄 gamesystem.java

📁 SSO客户端
💻 JAVA
字号:
/*
 * GameSystem.java
 *
 * Created on 2006年1月23日, 下午5:49
 *
 * 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 GameSystem {
   
    static LoginContext lc = null;
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception{
       // 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( "Enter Game System? ");
    System.out.flush();
    String answer = new BufferedReader(new InputStreamReader(System.in)).readLine();
    if (answer.substring(0,1).equalsIgnoreCase("y")) {
        System.out.println("Sorry, This is working time, please don't play Games!");
    }
    
    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 + -