Package org.jboss.ballroom.client.rbac

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


    protected void doRevealPlace(final PlaceRequest request, final boolean updateBrowserUrl) {
        Function<ContextCreation> createContext = new Function<ContextCreation>() {
            @Override
            public void execute(final Control<ContextCreation> control) {
                final String nameToken = control.getContext().getRequest().getNameToken();
                final SecurityContext context = securityFramework.getSecurityContext(nameToken);
                if (context == null || (context instanceof ReadOnlyContext)) {
                    // force re-creation if read-only fallback
                    securityFramework.createSecurityContext(nameToken, new AsyncCallback<SecurityContext>() {
                        @Override
                        public void onFailure(Throwable throwable) {
                            control.getContext().setError(throwable);
                            control.abort();
                        }

                        @Override
                        public void onSuccess(SecurityContext securityContext) {
                            control.proceed();
                        }
                    });
                } else {
                    control.proceed();
                }
            }
        };

        Outcome<ContextCreation> outcome = new Outcome<ContextCreation>() {
                    @Override
                    public void onFailure(ContextCreation context) {
                        unlock();
                        //noinspection ThrowableResultOfMethodCallIgnored
                        Console.error("Failed to create security context", context.getError().getMessage());
                    }

                    @Override
                    public void onSuccess(final ContextCreation context) {
                        // unlock(); // remove?
                        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                            @Override
                            public void execute() {
                                final PlaceRequest placeRequest = context.getRequest();
                                DefaultPlaceManager.super.doRevealPlace(placeRequest, updateBrowserUrl);
                                StringBuffer nameToken = new StringBuffer(placeRequest.getNameToken());

                                if(!placeRequest.getParameterNames().isEmpty())
                                {
View Full Code Here


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

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

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

                    if (!opPrivilege.isGranted()) {
View Full Code Here

        contextAwareWidgets.remove(id);
    }

    @Override
    public void onSecurityContextChanged(final SecurityContextChangedEvent event) {
        SecurityContext context = event.getSecurityContext();
        String addressTemplate = event.getResourceAddress();
        System.out.println("<SCC>");

        if (context == null) {
            // address resolution
            ModelNode addressNode = AddressMapping.fromString(addressTemplate).asResource(coreGUIContext,
                    event.getWildcards());
            String resourceAddress = normalize(addressNode.get(ADDRESS));
            System.out.println(
                    "\tReceiving security context change event for " + addressTemplate + " -> " + resourceAddress);

            // look for child context
            context = getSecurityContext();
            if (context.hasChildContext(resourceAddress)) {
                System.out.println("\tFound child context for " + resourceAddress);
                context = context.getChildContext(resourceAddress);
            }
        } else {
            System.out.println("\tReceiving security context change event for " + context);
        }
View Full Code Here

     * @param placeRequest the place request
     */
    public void update(final HasHandlers eventSource, final PlaceRequest placeRequest) {
        final String token = placeRequest.getNameToken();
        final String parametrizedToken = tokenFormatter.toPlaceToken(placeRequest);
        final SecurityContext context = lookupContext(placeRequest);
        if (context == null) {
            securityFramework.createSecurityContext(parametrizedToken, accessControlMetaData.getResources(token),
                    accessControlMetaData.isRecursive(token), new AsyncCallback<SecurityContext>() {
                        @Override
                        public void onFailure(final Throwable caught) {
View Full Code Here

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

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

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

                    if (!opPrivilege.isGranted()) {
View Full Code Here

                            }
                        });
            }
        }));

        SecurityContext securityContext = Console.MODULES.getSecurityFramework().getSecurityContext(presenter.getProxy().getNameToken());

        final ModelNodeFormBuilder.FormAssets formAssets = new ModelNodeFormBuilder()
                .setConfigOnly()
                .setResourceDescription(definition)
                .setSecurityContext(securityContext).build();
View Full Code Here

        // else replay
    }

    @Override
    public Widget buildWidget(ResourceAddress address, ResourceDefinition definition) {
        SecurityContext securityContext = Console.MODULES.getSecurityFramework().getSecurityContext(presenter.getProxy().getNameToken());

        final ModelNodeFormBuilder.FormAssets formAssets = new ModelNodeFormBuilder()
                .setConfigOnly()
                .setResourceDescription(definition)
                .setSecurityContext(securityContext).build();
View Full Code Here

                            }
                        });
            }
        }));

        SecurityContext securityContext = Console.MODULES.getSecurityFramework().getSecurityContext(NameTokens.HttpPresenter);

        final ModelNodeFormBuilder.FormAssets formAssets = new ModelNodeFormBuilder()
                .setConfigOnly()
                .setResourceDescription(definition)
                .setSecurityContext(securityContext).build();
View Full Code Here

                            }
                        });
            }
        }));

        SecurityContext securityContext = Console.MODULES.getSecurityFramework().getSecurityContext(presenter.getProxy().getNameToken());

        final ModelNodeFormBuilder.FormAssets formAssets = new ModelNodeFormBuilder()
                .setConfigOnly()
                .setResourceDescription(definition)
                .setSecurityContext(securityContext).build();
View Full Code Here

            Context context) {


        Map<QName, ModelNode> operationDescriptions = null;

        final SecurityContext securityContext = context.get(ContextKey.SECURITY_CONTEXT);
        assert securityContext!=null : "Security context is missing";

        if(context.has(ContextKey.OPERATION_DESCRIPTIONS))
            operationDescriptions = context.get(ContextKey.OPERATION_DESCRIPTIONS);
        else
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.