Package org.geomajas.security

Examples of org.geomajas.security.GeomajasSecurityException


                recorder.record("layer", "Invalidate geometry for deleted feature");
                cacheManager.invalidate(layer, geometry.getEnvelopeInternal());
              }
            }
          } else {
            throw new GeomajasSecurityException(ExceptionCode.FEATURE_DELETE_PROHIBITED,
                oldFeature.getId(), securityContext.getUserId());
          }
        }
      }
    } catch (Throwable t) { //NOPMD
View Full Code Here


    if (user == null || "".equals(user)) {
      if (settings != null && settings.isAllowAnonymous() && settings.isAnonymousCanEdit()) {
        user = "anonymous";
        anonymous = true;
      } else {
        throw new GeomajasSecurityException(ExceptionCode.CREDENTIALS_MISSING_OR_INVALID, "Need username.");
      }
    }

    try {
      SearchFavourite sf = searchFavouritesService.getSearchFavourite(request.getSearchFavouriteId());
View Full Code Here

          feature = featureModel.newInstance(newFeature.getId());
        }
        context.put(PipelineCode.FEATURE_DATA_OBJECT_KEY, feature);
        context.put(PipelineCode.IS_CREATE_KEY, true);
      } else {
        throw new GeomajasSecurityException(ExceptionCode.FEATURE_CREATE_PROHIBITED, securityContext
            .getUserId());
      }
    }
  }
View Full Code Here

    String user = securityContext.getUserName();
    if (user == null || "".equals(user)) {
      if (settings != null && settings.isAllowAnonymous() && settings.isAnonymousCanEdit()) {
        user = "anonymous";
      } else {
        throw new GeomajasSecurityException(ExceptionCode.CREDENTIALS_MISSING_OR_INVALID, "Need username.");
      }
    }

    response.setPrivateSearchFavourites(searchFavouritesService.getPrivateSearchFavourites(user));
    response.setSharedSearchFavourites(searchFavouritesService.getSharedSearchFavourites());
View Full Code Here

            Filter securityFilter = getSecurityFilter(layer,
                securityContext.getDeleteAuthorizedArea(layerId));
            if (securityFilter.evaluate(featureObj)) {
              layer.delete(oldFeature.getId());
            } else {
              throw new GeomajasSecurityException(ExceptionCode.FEATURE_DELETE_PROHIBITED,
                  oldFeature.getId(), securityContext.getUserId());
            }
          }
        } else {
          throw new GeomajasSecurityException(ExceptionCode.FEATURE_DELETE_PROHIBITED,
              oldFeature.getId(), securityContext.getUserId());
        }
      }
      context.setFinished(true); // stop pipeline execution
    }
View Full Code Here

        if (!securityManager.createSecurityContext(userToken)) {
          // not authorized
          response = new CommandResponse();
          response.setId(id);
          response.getErrors().add(
              new GeomajasSecurityException(ExceptionCode.CREDENTIALS_MISSING_OR_INVALID, userToken));
          response.setExecutionTime(System.currentTimeMillis() - begin);
          return response;
        }
      }

      // check access rights for the command
      if (securityContext.isCommandAuthorized(commandName)) {

        Command command = null;
        try {
          command = applicationContext.getBean(commandName, Command.class);
        } catch (BeansException be) {
          log.error("could not create command bean for {}", new Object[] { commandName }, be);
        }
        if (null != command) {
          response = command.getEmptyCommandResponse();
          response.setId(id);
          try {
            command.execute(request, response);
          } catch (Throwable throwable) { //NOPMD
            log.error("Error executing command", throwable);
            response.getErrors().add(throwable);
          }
        } else {
          response = new CommandResponse();
          response.setId(id);
          response.getErrors().add(new GeomajasException(ExceptionCode.COMMAND_NOT_FOUND, commandName));
        }

      } else {
        // not authorized
        response = new CommandResponse();
        response.setId(id);
        response.getErrors().add(
            new GeomajasSecurityException(ExceptionCode.COMMAND_ACCESS_DENIED, commandName, securityContext
                .getUserId()));
      }

      // Now process the errors for display on the client:
      List<Throwable> errors = response.getErrors();
View Full Code Here

      if (securityContext.isFeatureUpdateAuthorized(layerId, oldFeature, newFeature)) {
        if (null == context.getOptional(PipelineCode.FEATURE_DATA_OBJECT_KEY)) {
          context.put(PipelineCode.FEATURE_DATA_OBJECT_KEY, layer.read(newFeature.getId()));
        }
      } else {
        throw new GeomajasSecurityException(ExceptionCode.FEATURE_UPDATE_PROHIBITED,
            oldFeature.getId(), securityContext.getUserId());
      }
    }
  }
View Full Code Here

    if (user == null || "".equals(user)) {
      if (settings != null && settings.isAllowAnonymous() && settings.isAnonymousCanEdit()) {
        user = "anonymous";
        anonymous = true;
      } else {
        throw new GeomajasSecurityException(ExceptionCode.CREDENTIALS_MISSING_OR_INVALID, "Need username.");
      }
    }

    try {
      // -- new --
View Full Code Here

      if (isCreate) {
        newFeature.setId(featureModel.getId(feature));
      }
    } else {
      if (isCreate) {
        throw new GeomajasSecurityException(ExceptionCode.FEATURE_CREATE_PROHIBITED,
            securityContext.getUserId());
      } else {
        throw new GeomajasSecurityException(ExceptionCode.FEATURE_UPDATE_PROHIBITED, newFeature.getId(),
            securityContext.getUserId());       
      }
    }
  }
View Full Code Here

    return new CommandResponse();
  }

  public void execute(EmptyCommandRequest emptyCommandRequest, CommandResponse commandResponse) throws Exception {
    if(securityContext.getToken() == null){
      throw new GeomajasSecurityException(ExceptionCode.TEST);
    }
    if(!"marino".equals(securityContext.getUserId())){
      throw new GeomajasSecurityException(ExceptionCode.TEST);
    }
  }
View Full Code Here

TOP

Related Classes of org.geomajas.security.GeomajasSecurityException

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.