Package org.openmhealth.reference.exception

Examples of org.openmhealth.reference.exception.InvalidAuthenticationException


    final String data)   
    throws OmhException {
   
    if(authToken == null) {
      throw
        new InvalidAuthenticationException(
          "The authentication token is missing.");
    }
    if(schemaId == null) {
      throw new OmhException("The schema ID is missing.");
    }
View Full Code Here


    User user = UserBin.getInstance().getUser(username);
   
    // Make sure the user exists.
    if(user == null) {
      throw
        new InvalidAuthenticationException(
          MESSAGE_AUTHENTICATION_FAILURE);
    }
   
    // Check the password.
    if(! user.checkPassword(password)) {
      throw
        new InvalidAuthenticationException(
          MESSAGE_AUTHENTICATION_FAILURE);
    }
   
    return user;
  }
View Full Code Here

            }
            // If we have a token, make sure that this token is
            // identical to it.
            else if(! authToken.equals(cookie.getValue())) {
              throw
                new InvalidAuthenticationException(
                  "Multiple, different authentication " +
                    "token cookies were given.");
            }
          }
        }
      }
    }
   
    // Get the authentication tokens from the parameters.
    boolean authTokenIsFromParameters = false;
    String[] authTokenParameters =
      request
        .getParameterValues(Version1.PARAM_AUTHENTICATION_AUTH_TOKEN);
    // If any authentication token parameters exist, validate that there is
    // only one and then remember it.
    if(authTokenParameters != null) {
      // Cycle through the array and check all of the authentication
      // tokens.
      for(int i = 0; i < authTokenParameters.length; i++) {
        // As long as their is one element in the array, this can be
        // set. If there is a problem with the input, this being set
        // will be irrelevant.
        authTokenIsFromParameters = true;
       
        // If we have not yet found a token, save this one.
        if(authToken == null) {
          authToken = authTokenParameters[i];
        }
        // If we have a token, make sure that this token is
        // identical to it.
        else if(! authToken.equals(authTokenParameters[i])) {
          throw
            new InvalidAuthenticationException(
              "Multiple, different authentication token " +
                "parameters were given.");
        }
      }
    }
   
    // If we found a token, store it.
    if(authToken != null) {
      // Attempt to get the authentication token.
      AuthenticationToken authTokenObject =
        AuthenticationTokenBin.getInstance().getToken(authToken);
      if(authTokenObject == null) {
        throw
          new InvalidAuthenticationException(
            "The authentication token is unknown or has expired.");
      }
       
      // Associate the authentication token with the request.
      request
View Full Code Here

   
    super(numToSkip, numToReturn);
   
    if(authenticationToken == null) {
      throw
        new InvalidAuthenticationException(
          "No authentication token was provided.");
    }
    if(schemaId == null) {
      throw new OmhException("The schema ID is missing.");
    }
View Full Code Here

TOP

Related Classes of org.openmhealth.reference.exception.InvalidAuthenticationException

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.