Examples of AuthorizationException


Examples of br.gov.frameworkdemoiselle.security.AuthorizationException

      getLogger().trace(getBundle().getString("access-checking", username, operation, resource));
    }

    if (!getSecurityContext().hasPermission(resource, operation)) {
      getLogger().error(getBundle().getString("access-denied", username, operation, resource));
      throw new AuthorizationException(getBundle().getString("access-denied-ui", resource, operation));
    }

    getLogger().debug(getBundle().getString("access-allowed", username, operation, resource));
    return ic.proceed();
  }
View Full Code Here

Examples of ch.iterate.openstack.swift.exception.AuthorizationException

            catch(JsonParseException e) {
                throw new IOException(e.getMessage(), e);
            }
        }
        else if(response.getStatusLine().getStatusCode() == 401 || response.getStatusLine().getStatusCode() == 403) {
            throw new AuthorizationException(new Response(response));
        }
        throw new GenericException(new Response(response));
    }
View Full Code Here

Examples of com.arnaudpiroelle.marvel.api.exceptions.AuthorizationException

        Response r = cause.getResponse();
        ErrorResponse data = (ErrorResponse) cause.getBodyAs(ErrorResponse.class);

        if (r != null) {
            if (r.getStatus() == 401) {
                return new AuthorizationException(data.getMessage(), cause);
            } else if (r.getStatus() == 403) {
                //TODO: Forbidden
            } else if (r.getStatus() == 404) {
                return new EntityNotFoundException(data.getMessage(), cause);
            } else if (r.getStatus() == 405) {
View Full Code Here

Examples of com.belladati.sdk.exception.auth.AuthorizationException

    try {
      HttpParameters oauthParams = OAuth.decodeForm(new ByteArrayInputStream(content));
      if (oauthParams.containsKey("oauth_problem")) {
        String problem = oauthParams.getFirst("oauth_problem");
        if ("missing_consumer".equals(problem) || "invalid_consumer".equals(problem)) {
          return new AuthorizationException(Reason.CONSUMER_KEY_UNKNOWN);
        } else if ("invalid_signature".equals(problem) || "signature_invalid".equals(problem)) {
          return new AuthorizationException(hasToken ? Reason.TOKEN_INVALID : Reason.CONSUMER_SECRET_INVALID);
        } else if ("domain_expired".equals(problem)) {
          return new AuthorizationException(Reason.DOMAIN_EXPIRED);
        } else if ("missing_token".equals(problem) || "invalid_token".equals(problem)) {
          return new AuthorizationException(Reason.TOKEN_INVALID);
        } else if ("unauthorized_token".equals(problem)) {
          return new AuthorizationException(Reason.TOKEN_UNAUTHORIZED);
        } else if ("token_expired".equals(problem)) {
          return new AuthorizationException(Reason.TOKEN_EXPIRED);
        } else if ("x_auth_disabled".equals(problem)) {
          return new AuthorizationException(Reason.X_AUTH_DISABLED);
        } else if ("piccolo_not_enabled".equals(problem)) {
          return new AuthorizationException(Reason.BD_MOBILE_DISABLED);
        } else if ("missing_username".equals(problem) || "missing_password".equals(problem)
          || "invalid_credentials".equals(problem) || "permission_denied".equals(problem)) {
          return new AuthorizationException(Reason.USER_CREDENTIALS_INVALID);
        } else if ("account_locked".equals(problem) || "user_not_active".equals(problem)) {
          return new AuthorizationException(Reason.USER_ACCOUNT_LOCKED);
        } else if ("domain_restricted".equals(problem)) {
          return new AuthorizationException(Reason.USER_DOMAIN_MISMATCH);
        } else if ("timestamp_refused".equals(problem)) {
          String acceptable = oauthParams.getFirst("oauth_acceptable_timestamps");
          if (acceptable != null && acceptable.contains("-")) {
            return new InvalidTimestampException(Long.parseLong(acceptable.split("-")[0]), Long.parseLong(acceptable
              .split("-")[1]));
          }
        }
        return new AuthorizationException(Reason.OTHER, problem);
      }
      return new UnexpectedResponseException(code, new String(content));
    } catch (IOException e) {
      throw new UnexpectedResponseException(code, new String(content), e);
    }
View Full Code Here

Examples of com.cloudcontrolled.api.client.exception.AuthorizationException

    CreateTokenResponse createTokenResponse;
    try {
      createTokenResponse = send(createTokenRequest);
    } catch (ValidationConstraintViolationException vcve) {
      throw new AuthorizationException(vcve);
    }

    HttpStatus status = HttpStatus.getStatus(createTokenResponse.getStatusCode());
    if (status.isError()) {
      if (status.equals(HttpStatus.Unauthorized)) {
        throw new AuthorizationException(HttpStatus.Unauthorized.toString());
      } else {
        throw new CommunicationErrorException(status);
      }
    }
View Full Code Here

Examples of com.cosmo.security.auth.AuthorizationException

            roles.add(readRole(rs));
         }
      }
      catch (Exception ex)
      {
         throw new AuthorizationException(ex.getMessage(), ex);
      }
     
      return roles;
   }
View Full Code Here

Examples of com.jada.order.payment.AuthorizationException

      throw new PaymentException(e.getMessage());
    }
    String approved = result.getResponseText();
    if (!approved.equals(RESULT_APPROVED)) {
      paymentMessage = result.getReCo() + ": " + approved;
      throw new AuthorizationException(paymentMessage);
    }
    if (result.getTransaction() != null) authCode = result.getTransaction()[0].getAuthCode();
    paymentReference1 = result.getDpsTxnRef();
    paymentReference2 = result.getTxnRef();   
    paymentType = PAYMENT_TYPE;
View Full Code Here

Examples of com.liferay.faces.portal.security.AuthorizationException

  public void checkUserPortletPermission(String actionId) throws AuthorizationException {

    try {

      if (!userHasPortletPermission(actionId)) {
        throw new AuthorizationException("User " + getUserId() + " not authorized to perform action " +
          actionId);
      }
    }
    catch (Exception e) {
      throw new AuthorizationException("Exception checking permissions for actionId " + actionId, e);

    }
  }
View Full Code Here

Examples of com.porterhead.rest.user.exception.AuthorizationException

    public ExternalUser getUser(ExternalUser requestingUser, String userIdentifier) {
        Assert.notNull(requestingUser);
        Assert.notNull(userIdentifier);
        User user = ensureUserIsLoaded(userIdentifier);
        if(!requestingUser.getId().equals(user.getUuid().toString()) && !requestingUser.getRole().equalsIgnoreCase(Role.administrator.toString()))  {
           throw new AuthorizationException("User not authorized to load profile");
        }
        return new ExternalUser(user);
    }
View Full Code Here

Examples of com.porterhead.rest.user.exception.AuthorizationException

        Assert.notNull(userId);
        User userToDelete = ensureUserIsLoaded(userId);
        if (userMakingRequest.getRole().equalsIgnoreCase(Role.administrator.toString()) && (userToDelete.hasRole(Role.anonymous) || userToDelete.hasRole(Role.authenticated))) {
            userRepository.delete(userToDelete);
        } else {
            throw new AuthorizationException("User cannot be deleted. Only users with anonymous or authenticated role can be deleted.");
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.