Package edu.wpi.cs.wpisuitetng.exceptions

Examples of edu.wpi.cs.wpisuitetng.exceptions.AuthenticationException


        throw new UnauthorizedException();
      }
    }
    else
    {
      throw new AuthenticationException("Could not find WPISuite cookie. Please Login to recieve one.");
    }
   
    return s; 
  }
View Full Code Here


      System.out.println("DEBUG: Retrieve Login User");
      logger.log(Level.INFO, "Attempting to retrieve User...");
      u = manager.getUsers().getEntity(credentials[0]);
    } catch (NotFoundException e) {
      logger.log(Level.WARNING, "Login attempted with non-existant user <" + credentials[0] + ">");
      throw new AuthenticationException("The user \"" + credentials[0] + "\" could not be found. Please check if the username was spelled correctly.");
    }

    User user = u[0];
   
    // check password
    System.out.println("DEBUG: Authenticate Password");
    // password security
    logger.log(Level.INFO, "Authenticating password for User <" + credentials[0] + ">...");
    String hashedPassword = this.passwordHash.generateHash(credentials[1]);
    if(!user.matchPassword(hashedPassword))
    {
      logger.log(Level.WARNING, "Login attempted with bad password for User <" + credentials[0] + ">");
      throw new AuthenticationException("An invalid password was given. Please check the password and try again.");
    }
    logger.log(Level.INFO, "Password authentication Success! <" + credentials[0] + ">");
   
    // create a Session mapping in the ManagerLayer
    SessionManager sessions = manager.getSessions();
View Full Code Here

    String[] parts = post.split(" ");
   
    if(!isValidBasicAuth(parts))
    {
      logger.log(Level.WARNING, "Login attempted with invalid BasicAuth token");
      throw new AuthenticationException("The <" + this.getAuthType() + "> authentication token is invalid format");
    }
   
    byte[] decoded = Base64.decodeBase64(parts[1]);
   
    String[] credentials = (new String(decoded)).split(":"); // split decoded token username:password
   
    // check if the credential array has space for username and password elements.
    if(credentials.length != 2)
    {
      logger.log(Level.WARNING, "Login attempted with invalid BasicAuth token");
      throw new AuthenticationException("The <" + this.getAuthType() + "> token's encoded portion is missing a piece");
    }
   
    return credentials;
  }
View Full Code Here

TOP

Related Classes of edu.wpi.cs.wpisuitetng.exceptions.AuthenticationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.