Examples of UnauthorizedException


Examples of org.apache.blur.console.filters.UnauthorizedException

  protected void authorize(HttpServletRequest request, String... roles) {
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");
    if(user == null) {
      throw new UnauthorizedException();
    }
    for(String role: roles) {
      if(user.hasRole(role)){
        return;
      }
View Full Code Here

Examples of org.apache.cassandra.exceptions.UnauthorizedException

    {
        state.validateLogin();
        AuthenticatedUser user = state.getUser();

        if (superuser != null && user.getName().equals(username))
            throw new UnauthorizedException("You aren't allowed to alter your own superuser status");

        if (superuser != null && !user.isSuper())
            throw new UnauthorizedException("Only superusers are allowed to alter superuser status");

        if (!user.isSuper() && !user.getName().equals(username))
            throw new UnauthorizedException("You aren't allowed to alter this user");

        if (!user.isSuper())
        {
            for (IAuthenticator.Option option : opts.getOptions().keySet())
            {
                if (!DatabaseDescriptor.getAuthenticator().alterableOptions().contains(option))
                    throw new UnauthorizedException(String.format("You aren't allowed to alter %s option", option));
            }
        }
    }
View Full Code Here

Examples of org.apache.cassandra.exceptions.UnauthorizedException

    public void checkAccess(ClientState state) throws UnauthorizedException
    {
        state.validateLogin();

        if (!state.getUser().isSuper())
            throw new UnauthorizedException("Only superusers are allowed to perfrom CREATE USER queries");
    }
View Full Code Here

Examples of org.apache.cassandra.exceptions.UnauthorizedException

    public void checkAccess(ClientState state) throws UnauthorizedException
    {
        state.validateLogin();
        if (!state.getUser().isSuper())
            throw new UnauthorizedException("Only superusers are allowed to perfrom DROP USER queries");
    }
View Full Code Here

Examples of org.apache.cassandra.exceptions.UnauthorizedException

        validateLogin();
        preventSystemKSSModification(keyspace, perm);
        if (perm.equals(Permission.SELECT) && READABLE_SYSTEM_RESOURCES.contains(resource))
            return;
        if (PROTECTED_AUTH_RESOURCES.contains(resource))
            throw new UnauthorizedException(String.format("Resource %s is inaccessible", resource));
        ensureHasPermission(perm, resource);
    }
View Full Code Here

Examples of org.apache.cassandra.exceptions.UnauthorizedException

        for (IResource r : Resources.chain(resource))
        {
            if (authorize(r).contains(perm))
                return;
        }
        throw new UnauthorizedException(String.format("User %s has no %s permission on %s or any of its parents",
                                                      user.getName(),
                                                      perm,
                                                      resource));
    }
View Full Code Here

Examples of org.apache.cassandra.exceptions.UnauthorizedException

    }

    private void preventSystemKSSModification(String keyspace, Permission perm) throws UnauthorizedException
    {
        if (Schema.systemKeyspaceNames.contains(keyspace.toLowerCase()) && !perm.equals(Permission.SELECT))
            throw new UnauthorizedException(keyspace + " keyspace is not user-modifiable.");
    }
View Full Code Here

Examples of org.apache.cassandra.exceptions.UnauthorizedException

    }

    public void validateLogin() throws UnauthorizedException
    {
        if (user == null)
            throw new UnauthorizedException("You have not logged in");
    }
View Full Code Here

Examples of org.apache.cassandra.exceptions.UnauthorizedException

    public void ensureNotAnonymous() throws UnauthorizedException
    {
        validateLogin();
        if (user.isAnonymous())
            throw new UnauthorizedException("You have to be logged in to perform this query");
    }
View Full Code Here

Examples of org.apache.shiro.authz.UnauthorizedException

    }

    protected void checkPermission(Permission permission, AuthorizationInfo info) {
        if (!isPermitted(permission, info)) {
            String msg = "User is not permitted [" + permission + "]";
            throw new UnauthorizedException(msg);
        }
    }
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.