예제 #1
0
 private String getMsg(String userId, String pass) {
   String key = kc.getKey(userId);
   String password = e.decrypt(key, pass);
   String returnMsg = "Error: Could not authenticate!";
   if (login(userId, password)) {
     String role = RoleFactory.getRole(userId);
     long timeStamp = System.currentTimeMillis() + (300000); // 5 min.
     System.out.println(timeStamp);
     returnMsg = e.encrypt(key, e.encrypt(kc.getKey("server"), role + "," + timeStamp));
   }
   return returnMsg;
 }
예제 #2
0
 public static void main(String[] args) {
   TokenService ts = new TokenService();
   if (args.length != 0) {
     kc.addKey(args[0], args[1]);
   }
   System.out.println(ts.login("", ""));
 }