Examples of ForbiddenException


Examples of br.com.caelum.restfulie.http.error.ForbiddenException

      throw new UnauthorizedException("Http error " + code
          + " when executing request");
    }

    if (code == 403) {
      throw new ForbiddenException("Http error " + code
          + " when executing request");
    }

    if (code == 404) {
      throw new NotFoundException("Http error " + code
View Full Code Here

Examples of com.gitblit.GitBlitException.ForbiddenException

      if (e.getMessage().indexOf("401") > -1) {
        // unauthorized
        throw new UnauthorizedException(url);
      } else if (e.getMessage().indexOf("403") > -1) {
        // requested url is forbidden by the requesting user
        throw new ForbiddenException(url);
      } else if (e.getMessage().indexOf("405") > -1) {
        // requested url is not allowed by the server
        throw new NotAllowedException(url);
      } else if (e.getMessage().indexOf("501") > -1) {
        // requested url is not recognized by the server
View Full Code Here

Examples of com.google.api.server.spi.response.ForbiddenException

            }
            else if (result.getReason() == "No seats available") {
                throw new ConflictException("There are no seats available");
            }
            else {
                throw new ForbiddenException("Unknown exception");
            }
        }
        return result;
    }
View Full Code Here

Examples of javax.ws.rs.ForbiddenException

        return getSubject().isPermitted(permission + ":" + instanceId);
    }

    protected void checkPermission(String permission) {
        if (!isPermitted(permission)) {
            throw new ForbiddenException("Not authorized");
        }
    }
View Full Code Here

Examples of javax.ws.rs.ForbiddenException

        return getSubject().isPermitted(permission);
    }

    protected void checkPermission(String permission, String instanceId) {
        if (!isPermitted(permission, instanceId)) {
            throw new ForbiddenException("Not authorized to access resource id " + instanceId);
        }
    }
View Full Code Here

Examples of javax.ws.rs.ForbiddenException

    public void checkSearchPermission(String filter, String searchPermission) {
        if (filter == null || filter.equals("*") || filter.isEmpty()) {
            checkPermission(searchPermission);
        } else {
            if(!filter.startsWith("streams:")) {
                throw new ForbiddenException("Not allowed to search with filter: [" + filter + "]");
            }

            String[] parts = filter.split(":");
            if (parts.length <= 1) {
                throw new ForbiddenException("Not allowed to search with filter: [" + filter + "]");
            }
           
            String streamList = parts[1];
            String[] streams = streamList.split(",");
            if (streams.length == 0 ) {
                throw new ForbiddenException("Not allowed to search with filter: [" + filter + "]");
            }

            for(String streamId : streams) {
                if (!isPermitted(RestPermissions.STREAMS_READ, streamId)) {
                    LOG.warn("Not allowed to search with filter: [" + filter + "]. (Forbidden stream: " + streamId + ")");
                    throw new ForbiddenException();
                }
            }
        }
    }
View Full Code Here

Examples of javax.ws.rs.ForbiddenException

                        return;
                    }
                }
            }

            throw new ForbiddenException();
        }
View Full Code Here

Examples of javax.ws.rs.ForbiddenException

                    break;
                case UNAUTHORIZED:
                    webAppException = new NotAuthorizedException(response);
                    break;
                case FORBIDDEN:
                    webAppException = new ForbiddenException(response);
                    break;
                case NOT_FOUND:
                    webAppException = new NotFoundException(response);
                    break;
                case METHOD_NOT_ALLOWED:
View Full Code Here

Examples of net.fortytwo.twitlogic.services.twitter.errors.ForbiddenException

                    case 400:
                        throw new BadRequestException();
                    case 401:
                        throw new UnauthorizedException();
                    case 403:
                        throw new ForbiddenException();
                    case 404:
                        throw new NotFoundException();
                    case 406:
                        showRequestInfo(request);
                        throw new NotAcceptableException();
View Full Code Here

Examples of net.sf.chellow.monad.ForbiddenException

        Party party = user.getParty();
        char marketRoleCode = party.getRole().getCode();
        if (marketRoleCode == MarketRole.HHDC) {
          Long hhdcContractId = inv.getLong("hhdc-contract-id");
          if (!inv.isValid()) {
            throw new ForbiddenException(
                "Need the parameter hhdc-contract-id.");
          }
          HhdcContract hhdcContract = HhdcContract
              .getHhdcContract(hhdcContractId);
          if (!hhdcContract.getParty().equals(party)) {
            throw new ForbiddenException(
                "The party associated with the contract you're trying to view doesn't match your party.");
          }
          if ((pathInfo + "?" + inv.getRequest().getQueryString())
              .startsWith("/reports/37/output/?hhdc-contract-id="
                  + hhdcContract.getId())) {
            return;
          }
        } else if (marketRoleCode == MarketRole.SUPPLIER) {
          if (pathInfo.startsWith("/supplier-contracts/"
              + party.getId())) {
            return;
          }
        }
      }
    }
    if (inv.getUser() == null) {
      throw new UnauthorizedException();
    }
    throw new ForbiddenException();
  }
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.