Examples of AuthorizationException


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

                User user = userRepository.findByUuid(userId);
                if (user != null) {
                    externalUser = new ExternalUser(user);
                    if (!isAuthorized(user, context, hashedToken)) {
                        throw new AuthorizationException("Request rejected due to an authorization failure");
                    }
                }
            }
        }
        return externalUser;
View Full Code Here

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

        DateTime now = new DateTime();
        DateTime offset = new DateTime(date);
        if (!(offset.isAfter(now.minusMinutes(config.getSessionDateOffsetInMinutes())) &&
                offset.isBefore(now.plusMinutes(config.getSessionDateOffsetInMinutes())))) {
            LOG.error("Date in header is out of range: {}", requestDateString);
            throw new AuthorizationException("Date in header is out of range: " + requestDateString);
        }
    }
View Full Code Here

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

    private void validateNonce(String nonceValue) {
        Nonce nonce = nonceCache.getUnchecked(nonceValue);
        Duration tolerance = new Duration(nonce.timestamp, new DateTime());
        if (tolerance.isLongerThan(Duration.millis(NONCE_CHECK_TOLERANCE_IN_MILLIS))) {
            LOG.error("Nonce value was not unique: {}", nonceValue);
            throw new AuthorizationException("Nonce value is not unique");
        }
    }
View Full Code Here

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

        if(token == null) {
            return externalUser;
        }
        User user =  userRepository.findBySession(token);
        if(user == null) {
            throw new AuthorizationException("Session token not valid");
        }
        AuthorizationToken authorizationToken = user.getAuthorizationToken();
            if (authorizationToken.getToken().equals(token)) {
                externalUser = new ExternalUser(user);
            }
View Full Code Here

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

    @Path("{userId}")
    @PUT
    public Response updateUser(@Context SecurityContext sc, @PathParam("userId") String userId, UpdateUserRequest request) {
        ExternalUser userMakingRequest = (ExternalUser)sc.getUserPrincipal();
        if(!userMakingRequest.getId().equals(userId)) {
            throw new AuthorizationException("User not authorized to modify this profile");
        }
        boolean sendVerificationToken = StringUtils.hasLength(request.getEmailAddress()) &&
                !request.getEmailAddress().equals(userMakingRequest.getEmailAddress());
        ExternalUser savedUser = userService.saveUser(userId, request);
        if(sendVerificationToken) {
View Full Code Here

Examples of com.sk89q.intake.util.auth.AuthorizationException

    @Override
    public boolean call(String stringArguments, CommandLocals locals, String[] parentCommands) throws CommandException, AuthorizationException {
        // Test permission
        if (!testPermission(locals)) {
            throw new AuthorizationException();
        }

        String calledCommand = parentCommands.length > 0 ? parentCommands[parentCommands.length - 1] : "_";
        String[] split = CommandContext.split(calledCommand + " " + stringArguments);
        CommandContext context = new CommandContext(split, getValueFlags(), false, locals);
View Full Code Here

Examples of com.sk89q.worldedit.util.auth.AuthorizationException

    }

    @Override
    public void checkPermission(String permission) throws AuthorizationException {
        if (!hasPermission(permission)) {
            throw new AuthorizationException();
        }
    }
View Full Code Here

Examples of de.iritgo.aktera.authorization.AuthorizationException

      operationCode = "*";
    }

    if (ue.getGroups().size() == 0)
    {
      throw new AuthorizationException("User '" + ue.getLoginName() + "' is not a member of any groups");
    }

    try
    {
      pf = getPersistentFactory();

      Persistent serviceSecurity = pf.create("component-security.componentsecurity");

      serviceSecurity.setBypassAuthorizationManager(bypassAm);

      /* Iterate through all the groups that this principal is a member of */
      String oneGroup = null;

      for (Iterator j = ue.getGroups().iterator(); j.hasNext();)
      {
        oneGroup = (String) j.next();

        serviceSecurity.clear();
        serviceSecurity.setField("component", getComponentName(o.getService()));
        serviceSecurity.setField("groupname", oneGroup);

        if (log.isDebugEnabled())
        {
          log.debug("Looking for " + serviceSecurity.toString());
        }

        if (serviceSecurity.find())
        {
          log.debug("Found componentsecurity record, checking operation " + operationCode);

          if (operationCode.equals("*"))
          {
            return true;
          }

          if (serviceSecurity.getFieldString("operationsallowed").indexOf(operationCode) > 0)
          {
            return true;
          }

          if (serviceSecurity.getFieldString("operationsallowed").equals("*"))
          {
            return true;
          }
        }
      }
    }
    catch (PersistenceException pe)
    {
      log.error("Database error checking authorization", pe);
      throw new AuthorizationException(pe);
    }
    catch (AuthorizationException ae)
    {
      log.error("Authorization error while checking authorization", ae);
      throw new AuthorizationException(ae);
    }
    finally
    {
      releaseService(pf);

View Full Code Here

Examples of org.apache.cassandra.thrift.AuthorizationException

            // structure:
            // given keyspace X, users A B and C can be authorized like this (separate their names with spaces):
            // X = A B C
           
            // note we keep the message here and for other authorization problems exactly the same to prevent attackers from guessing what keyspaces are valid
            if (null == props.getProperty(keyspace)) throw new AuthorizationException(authorizationErrorMessage(keyspace, username));
            for (String allow : props.getProperty(keyspace).split(","))
            {
                if (allow.equals(username)) authorized = true;
            }
        }
        catch (FileNotFoundException e)
        {
            throw new RuntimeException("Authorization table file given by property " + ACCESS_FILENAME_PROPERTY + " could not be found: " + e.getMessage());
        }
        catch (IOException e)
        {
            throw new RuntimeException("Authorization table file given by property " + ACCESS_FILENAME_PROPERTY + " could not be opened: " + e.getMessage());
        }
        catch (Exception e)
        {
            throw new RuntimeException("Unexpected authorization problem", e);
        }

        if (!authorized) throw new AuthorizationException(authorizationErrorMessage(keyspace, username));
    }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.metadata.AuthorizationException

    hiveObject = hiveObject + "}";

    if (inputCheck != null) {
      int input = this.firstFalseIndex(inputCheck);
      if (input >= 0) {
        throw new AuthorizationException("No privilege '"
            + inputRequiredPriv[input].getPriv() + "' found for inputs "
            + hiveObject);
      }
    }

    if (outputCheck != null) {
      int output = this.firstFalseIndex(outputCheck);
      if (output >= 0) {
        throw new AuthorizationException("No privilege '"
            + outputRequiredPriv[output].getPriv() + "' found for outputs "
            + hiveObject);
      }
    }
  }
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.