Package org.openmhealth.reference.exception

Examples of org.openmhealth.reference.exception.InvalidAuthorizationException


          else if(
            ! authorizationTokenString
              .equals(currElementParts[1])) {
           
            throw
              new InvalidAuthorizationException(
                "Multiple, different third-party " +
                  "credentials were provided as '" +
                  HEADER_AUTHORIZATION_BEARER +
                  "' " +
                  HEADER_AUTHORIZATION +
                  " headers.");
          }
        }
      }
     
      // If the authorization token was given, attempt to add the
      // third-party to the request.
      if(authorizationTokenString != null) {
        // Attempt to get the authorization token.
        AuthorizationToken authorizationToken =
          AuthorizationTokenBin
            .getInstance()
            .getTokenFromAccessToken(authorizationTokenString);
       
        // If the token is null, it does not exist or is expired.
        if(authorizationToken == null) {
          throw
            new InvalidAuthorizationException(
              "The authorization token is unknown or " +
                "expired.");
        }
       
        // Add the token to the request as an attribute.
View Full Code Here


          .getAuthorizationCode()
          .getScopes()
          .contains(schemaId)) {
       
        throw
          new InvalidAuthorizationException(
            "The authorization token does not grant access to " +
              "the given schema: " +
              schemaId);
      }
     
      // Ensure that the given authorization token grants access to the
      // user in question.
      if(
        ! authorizationToken
          .getAuthorizationCodeVerification()
          .getOwnerUsername()
          .equals(owner)) {
       
        throw
          new InvalidAuthorizationException(
            "The authorization token does not grant access to " +
              "the given user's data: " +
              owner);
      }
    }
View Full Code Here

TOP

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

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.