Ejemplo n.º 1
0
 public String login(String username, String password) {
   if (username == null || password == null) {
     return ("The user name or password you entered is incorrect.");
   }
   username = username.toLowerCase();
   log(INFO, "Logging in: " + username);
   try {
     if (!username.contains("@")) {
       log(ERROR, "User: "******" NOT email");
       return ("Enter a valid email address for your Cloud Foundry account.");
     }
     log(DEBUG, "Logging in user: = " + username);
     loginCredentials = new LoginCredentialsBean(username, password);
     Hashtable<String, Object> loginResult =
         spinupController.processLogin(loginCredentials, RuntimeAccess.getInstance().getRequest());
     secret = (SharedSecret) loginResult.get("secret");
     transportToken = (TransportToken) loginResult.get("token");
     if (secret != null && transportToken != null) {
       return ("SUCCESS " + username + " logged in");
     } else {
       return ("Unable able to authenticate. Problem getting token and/or secret.");
     }
   } catch (Exception e) {
     log(ERROR, "Login has failed " + e.getMessage());
     return ("The user name or password you entered is incorrect.");
   }
 }