Package org.jboss.ballroom.client.rbac

Examples of org.jboss.ballroom.client.rbac.AuthorisationDecision


        boolean outcome = false;

        if(securityFramework.hasContext(token))
        {
            SecurityContext securityContext = securityFramework.getSecurityContext(token);
            final AuthorisationDecision readPriviledge = securityContext.getReadPriviledge();
            outcome = readPriviledge.isGranted();

            //notify listeners (error messages, etc)
            Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                @Override
                public void execute() {
View Full Code Here


    private AuthorisationDecision checkPriviledge(Priviledge p) {

        if(!sealed)
            throw new RuntimeException("Should be sealed before policy decisions are evaluated");

        AuthorisationDecision decision = new AuthorisationDecision(true);
        for(String address : requiredResources)
        {
            final Constraints model = accessConstraints.get(address);
            if(model!=null)
            {
                if(!p.isGranted(model))
                {
                    decision.getErrorMessages().add(address);
                }
            }
            else
            {
                decision.getErrorMessages().add("Missing constraints for "+ address);
            }

            if(decision.hasErrorMessages())
            {
                decision.setGranted(false);
                break;
            }
        }

        return decision;
View Full Code Here

        Constraints constraints = accessConstraints.get(resourceAddress);
        assert constraints!=null : "Missing constraints for "+resourceAddress;

        boolean execPerm = constraints.isOperationExec(resourceAddress, operationName);
        AuthorisationDecision descision = new AuthorisationDecision(true);
        descision.setGranted(execPerm);
        return descision;
    }
View Full Code Here

                ToolButton btn = (ToolButton)widget;
                boolean visible = true;
                if(btn.hasOperationAddress()) // fine grained, doesn't usually apply but can help to overcome dge cases
                {
                    String[] operationAddress = btn.getOperationAddress();
                    AuthorisationDecision operationPriviledge = securityContext.getOperationPriviledge(operationAddress[0], operationAddress[1]);
                    visible = operationPriviledge.isGranted();
                }
                else
                {
                    visible = overallPrivilege; // coarse grained, inherited from parent
                }
View Full Code Here

                ToolButton btn = (ToolButton) widget;
                boolean visible = true;
                if (btn.hasOperationAddress()) // fine grained, doesn't usually apply but can help to overcome dge cases
                {
                    String[] operationAddress = btn.getOperationAddress();
                    AuthorisationDecision operationPriviledge = securityContext
                            .getOperationPriviledge(operationAddress[0], operationAddress[1]);
                    visible = operationPriviledge.isGranted();
                } else {
                    visible = overallPrivilege; // coarse grained, inherited from parent
                }

                if (!visible) {
View Full Code Here

        boolean outcome = false;

        if(securityFramework.hasContext(token))
        {
            SecurityContext securityContext = securityFramework.getSecurityContext(token);
            final AuthorisationDecision readPriviledge = securityContext.getReadPriviledge();


            // bootstrap operations
            boolean bootstrapRequirementsSatisfied = true;
            for(String op : accessControlMetaData.getOperations(token))
            {
                int idx = op.indexOf("#");
                AuthorisationDecision opPriv = securityContext.getOperationPriviledge(
                        op.substring(0, idx),
                        op.substring(idx + 1, op.length())
                );

                if(!opPriv.isGranted())
                {
                    bootstrapRequirementsSatisfied = false;
                    break;
                }
            }
View Full Code Here

    private AuthorisationDecision checkPriviledge(Priviledge p, boolean includeOptional) {

        if(!sealed)
            throw new RuntimeException("Should be sealed before policy decisions are evaluated");

        AuthorisationDecision decision = new AuthorisationDecision(true);
        for(ResourceRef ref : requiredResources)
        {
            if(ref.optional) continue; // skip optional ones

            final Constraints model = getConstraints(ref.address, false);
            if(model!=null)
            {
                if(!p.isGranted(model))
                {
                    decision.getErrorMessages().add(ref.address);
                }
            }
            else
            {
                decision.getErrorMessages().add("Missing constraints for "+ ref.address);
            }

            if(decision.hasErrorMessages())
            {
                decision.setGranted(false);
                break;
            }
        }

        return decision;
View Full Code Here

    }

    @Override
    public AuthorisationDecision getReadPrivilege(String resourceAddress) {
        Constraints constraints = getConstraints(resourceAddress, false);
        return new AuthorisationDecision(constraints.isReadResource());
    }
View Full Code Here

    }

    @Override
    public AuthorisationDecision getWritePrivilege(String resourceAddress) {
        Constraints constraints = getConstraints(resourceAddress, false);
        return new AuthorisationDecision(constraints.isWriteResource());
    }
View Full Code Here

        Constraints.AttributePerm attributePerm = constraints.attributePermissions.get(attributeName);

        if(null==attributePerm)
            throw new RuntimeException("No such attribute: "+ attributeName);

        return new AuthorisationDecision(attributePerm.isWrite());
    }
View Full Code Here

TOP

Related Classes of org.jboss.ballroom.client.rbac.AuthorisationDecision

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.