Package java.security

Examples of java.security.AccessControlException


        if (acEnabled != null && acEnabled.equals("false")) {
            Class mqadminc = null;
            try {
            mqadminc = Class.forName("com.sun.messaging.jmq.auth.jaas.MQAdminGroup");
            } catch (ClassNotFoundException e) {
            throw new AccessControlException(Globals.getBrokerResources().getKString(
            BrokerResources.X_INTERNAL_EXCEPTION, "ClassNotFoundException: "+e.getMessage()));
            }
            Set s = subject.getPrincipals(mqadminc);

            if (s == null || s.size() == 0) {
                throw new AccessControlException(
                    Globals.getBrokerResources().getKString(
            BrokerResources.X_NOT_ADMINISTRATOR, mquser.getName()));
            }
            return;
        }
View Full Code Here


        replay();

        // also test unwrapping TapestryExceptions
        exceptionHandler.handleRequestException(new OperationException(new RenderQueueException(
                "renderqueue", new Object[0], new TapestryException("tapestryexception",
                        new AccessControlException("No permission"))), new String[0]));
    }
View Full Code Here

        if (set.contains(READ_ACTION)) {
            try {
                targetId = hierMgr.resolvePath(targetPath);
                if (targetId == null) {
                    // target does not exist, throw exception
                    throw new AccessControlException(READ_ACTION);
                }
                accessMgr.checkPermission(targetId, AccessManager.READ);
            } catch (AccessDeniedException re) {
                // otherwise the RepositoryException catch clause will
                // log a warn message, which is not appropriate in this case.
                throw new AccessControlException(READ_ACTION);
            }
        }

        Path parentPath = null;
        ItemId parentId = null;

        /**
         * "add_node" action:
         * requires WRITE permission on parent item
         */
        if (set.contains(ADD_NODE_ACTION)) {
            try {
                parentPath = targetPath.getAncestor(1);
                parentId = hierMgr.resolvePath(parentPath);
                if (parentId == null) {
                    // parent does not exist (i.e. / was specified), throw exception
                    throw new AccessControlException(ADD_NODE_ACTION);
                }
                accessMgr.checkPermission(parentId, AccessManager.WRITE);
            } catch (AccessDeniedException re) {
                // otherwise the RepositoryException catch clause will
                // log a warn message, which is not appropriate in this case.
                throw new AccessControlException(ADD_NODE_ACTION);
            }
        }

        /**
         * "remove" action:
         * requires REMOVE permission on target item
         */
        if (set.contains(REMOVE_ACTION)) {
            try {
                if (targetId == null) {
                    targetId = hierMgr.resolvePath(targetPath);
                    if (targetId == null) {
                        // parent does not exist, throw exception
                        throw new AccessControlException(REMOVE_ACTION);
                    }
                }
                accessMgr.checkPermission(targetId, AccessManager.REMOVE);
            } catch (AccessDeniedException re) {
                // otherwise the RepositoryException catch clause will
                // log a warn message, which is not appropriate in this case.
                throw new AccessControlException(REMOVE_ACTION);
            }
        }

        /**
         * "set_property" action:
         * requires WRITE permission on parent item if property is going to be
         * added or WRITE permission on target item if property is going to be
         * modified
         */
        if (set.contains(SET_PROPERTY_ACTION)) {
            try {
                if (targetId == null) {
                    targetId = hierMgr.resolvePath(targetPath);
                    if (targetId == null) {
                        // property does not exist yet,
                        // check WRITE permission on parent
                        if (parentPath == null) {
                            parentPath = targetPath.getAncestor(1);
                        }
                        if (parentId == null) {
                            parentId = hierMgr.resolvePath(parentPath);
                            if (parentId == null) {
                                // parent does not exist, throw exception
                                throw new AccessControlException(SET_PROPERTY_ACTION);
                            }
                        }
                        accessMgr.checkPermission(parentId, AccessManager.WRITE);
                    } else {
                        // property does already exist,
                        // check WRITE permission on target
                        accessMgr.checkPermission(targetId, AccessManager.WRITE);
                    }
                }
            } catch (AccessDeniedException re) {
                // otherwise the RepositoryException catch clause will
                // log a warn message, which is not appropriate in this case.
                throw new AccessControlException(SET_PROPERTY_ACTION);
            }
        }
    }
View Full Code Here

    {
        if(desiredState == State.DELETED)
        {
            if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), TrustStore.class, Operation.DELETE))
            {
                throw new AccessControlException("Deletion of key store is denied");
            }
        }
    }
View Full Code Here

    private void authoriseSetAttribute()
    {
        if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), TrustStore.class, Operation.UPDATE))
        {
            throw new AccessControlException("Setting key store attributes is denied");
        }
    }
View Full Code Here

    @Override
    protected void authoriseSetAttribute(String name, Object expected, Object desired) throws AccessControlException
    {
        if (!_vhost.getSecurityManager().authoriseUpdate(_queue))
        {
            throw new AccessControlException("Setting of queue attribute is denied");
        }
    }
View Full Code Here

    @Override
    protected void authoriseSetAttributes(Map<String, Object> attributes) throws AccessControlException
    {
        if (!_vhost.getSecurityManager().authoriseUpdate(_queue))
        {
            throw new AccessControlException("Setting of queue attributes is denied");
        }
    }
View Full Code Here

    {
        if(desiredState == State.DELETED)
        {
            if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), AuthenticationProvider.class, Operation.DELETE))
            {
                throw new AccessControlException("Deletion of authentication provider is denied");
            }
        }
    }
View Full Code Here

    @Override
    protected void authoriseSetAttribute(String name, Object expected, Object desired) throws AccessControlException
    {
        if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), AuthenticationProvider.class, Operation.UPDATE))
        {
            throw new AccessControlException("Setting of authentication provider attributes is denied");
        }
    }
View Full Code Here

    @Override
    protected void authoriseSetAttributes(Map<String, Object> attributes) throws AccessControlException
    {
        if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), AuthenticationProvider.class, Operation.UPDATE))
        {
            throw new AccessControlException("Setting of authentication provider attributes is denied");
        }
    }
View Full Code Here

TOP

Related Classes of java.security.AccessControlException

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.