Package org.jboss.ballroom.client.rbac

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


    }

    @Override
    public SecurityContext getSecurityContext(String id) {

        SecurityContext securityContext = contextMapping.get(id);
        return securityContext;
    }
View Full Code Here


    }

    @Override
    public SecurityContext getSecurityContext(String nameToken) {

        SecurityContext securityContext = contextMapping.get(nameToken);
        if(null==securityContext)
            throw new IllegalStateException("Security context should have been created upfront");

        return securityContext;
    }
View Full Code Here


                ModelNode response = dmrResponse.get();
                ModelNode overalResult = response.get(RESULT);

                SecurityContext context = new SecurityContext(nameToken, resources);
                context.setFacet(Facet.valueOf(accessControlReg.getFacet(nameToken).toUpperCase()));

                try {

                    // retrieve access constraints per required resource and update the security context
                    for(int i=1; i<=steps.size();i++)
                    {
                        String step = "step-"+i;
                        if(overalResult.hasDefined(step))
                        {
                            ModelNode modelNode = overalResult.get(step).get(RESULT);

                            ModelNode stepResult = null;
                            if(modelNode.getType() == ModelType.LIST)
                                stepResult = modelNode.asList().get(0);
                            else
                                stepResult = modelNode;

                            ModelNode accessControl = stepResult.hasDefined(RESULT) ?
                                    stepResult.get(RESULT).get("access-control") : stepResult.get("access-control");

                            List<Property> properties = accessControl.isDefined() ?
                                    accessControl.asPropertyList() : Collections.EMPTY_LIST;

                            if(!properties.isEmpty())
                            {
                                Property acl = properties.get(0);
                                assert acl.getName().equals("default");   //TODO: overrides ...
                                ModelNode model = acl.getValue();

                                Constraints c = new Constraints();

                                if(model.hasDefined("address")
                                        && model.get("address").asBoolean()==false)
                                {
                                    c.setAddress(false);
                                }
                                else
                                {

                                    c.setReadConfig(model.get("read-config").asBoolean());
                                    c.setWriteConfig(model.get("write-config").asBoolean());
                                    c.setReadRuntime(model.get("read-runtime").asBoolean());
                                    c.setWriteRuntime(model.get("write-runtime").asBoolean());

                                }

                                // TODO: attribute constraints

                                context.updateResourceConstraints(step2address.get(step), c);
                            }
                        }
                    }
                } catch (Throwable e) {
                    Log.error("Failed to parse response", e);
                    callback.onFailure(new RuntimeException("Failed to parse response", e));
                }

                context.seal(); // makes it immutable

                contextMapping.put(nameToken, context);

                callback.onSuccess(context);
View Full Code Here

        String token = placemanager.getCurrentPlaceRequest().getNameToken();
        boolean outcome = false;

        if(securityService.hasContext(token))
        {
            SecurityContext securityContext = securityService.getSecurityContext(token);
            outcome = securityContext.isReadable();
        }

        return outcome;
    }
View Full Code Here

    }

    @Override
    public SecurityContext getSecurityContext(String id) {

        SecurityContext securityContext = contextMapping.get(id);
        return securityContext;
    }
View Full Code Here

    }

    @Override
    public Set<String> getReadOnlyNames() {
        SecurityService securityFacilities = framework.getSecurityService();
        SecurityContext securityContext = securityFacilities.getSecurityContext();

        if(resourceAddress !=null)
        {
            return securityFacilities.getReadOnlyJavaNames(conversionType, resourceAddress, securityContext);
        }
View Full Code Here

        deck = new FormDeckPanel();
        deck.setStyleName("fill-layout-width");

        // RBAC
        SecurityContext securityContext = getSecurityContext();
        boolean writePriviledges = securityContext.getWritePriviledge().isGranted();

        // ----------------------
        // view panel

        VerticalPanel viewPanel = new VerticalPanel();
View Full Code Here

        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
View Full Code Here

    }

    @Override
    public SecurityContext getSecurityContext(String id) {

        SecurityContext securityContext = contextMapping.get(id);
        if(null==securityContext)
            throw new IllegalStateException("Security context should have been created upfront: "+id);

        return securityContext;
    }
View Full Code Here

    HtmlGenerator() {
        this.html = new SafeHtmlBuilder();
        this.lifecycleIds = new ArrayList<String>();

        // access control
        SecurityContext securityContext = SECURITY_SERVICE.getSecurityContext();
        this.writable = securityContext.getWritePriviledge().isGranted();
    }
View Full Code Here

TOP

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

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.