Package org.uberfire.security.authz

Examples of org.uberfire.security.authz.RuntimeResource


    @AroundInvoke
    public Object interceptInvoke( final InvocationContext ctx ) throws Exception {

        final Method method = ctx.getMethod();

        final RuntimeResource resource = new RuntimeResource() {

            List<String> roles = null;
            List<String> traits = null;

            @Override
View Full Code Here


        }
        boolean refreshCache = false;
        if (resource instanceof Cacheable) {
            refreshCache = ((Cacheable) resource).requiresRefresh();
        }
        final RuntimeResource runtimeResource = (RuntimeResource) resource;

        if (cache.notContains(subject, runtimeResource) || refreshCache) {
            if (!resourceManager.requiresAuthentication(runtimeResource)) {
                return ACCESS_ABSTAIN;
            }
View Full Code Here

    @Test
    public void testAuthorizeWithCacheRefreshOnRemoveAllRoles() {
        RuntimeAuthorizationManager authorizationManager = new RuntimeAuthorizationManager();

        RuntimeResource resource = new TestRuntimeResource("test1234", "author");
        Subject john = new TestIdentity("john", "admin");
        Subject mary = new TestIdentity("mary", "author");

        assertTrue(resource instanceof Cacheable);
        assertTrue(((Cacheable) resource).requiresRefresh());

        boolean authorized = authorizationManager.authorize(resource, john);
        assertFalse(authorized);
        assertFalse(((Cacheable) resource).requiresRefresh());

        authorized = authorizationManager.authorize(resource, mary);
        assertTrue(authorized);
        // now simulate remove of the roles for the resource
        RuntimeResource resource2 = new TestRuntimeResource("test1234"null);

        assertTrue(((Cacheable) resource2).requiresRefresh());

        authorized = authorizationManager.authorize(resource2, john);
        assertTrue(authorized);
View Full Code Here

    @Test
    public void testAuthorizeWithCacheRefreshOnAddedRole() {
        RuntimeAuthorizationManager authorizationManager = new RuntimeAuthorizationManager();

        RuntimeResource resource = new TestRuntimeResource("test1234", "author");
        Subject john = new TestIdentity("john", "admin");
        Subject mary = new TestIdentity("mary", "author");

        assertTrue(resource instanceof Cacheable);
        assertTrue(((Cacheable) resource).requiresRefresh());

        boolean authorized = authorizationManager.authorize(resource, john);
        assertFalse(authorized);
        assertFalse(((Cacheable) resource).requiresRefresh());

        authorized = authorizationManager.authorize(resource, mary);
        assertTrue(authorized);
        // now simulate add of a role for the resource
        RuntimeResource resource2 = new TestRuntimeResource("test1234""admin", "author");

        assertTrue(((Cacheable) resource2).requiresRefresh());

        authorized = authorizationManager.authorize(resource2, john);
        assertTrue(authorized);
View Full Code Here

    @Test
    public void testAuthorizeWithCacheRefreshOnRemovedRole() {
        RuntimeAuthorizationManager authorizationManager = new RuntimeAuthorizationManager();

        RuntimeResource resource = new TestRuntimeResource("test1234", "admin", "author");
        Subject john = new TestIdentity("john", "admin");
        Subject mary = new TestIdentity("mary", "author");

        assertTrue(resource instanceof Cacheable);
        assertTrue(((Cacheable) resource).requiresRefresh());

        boolean authorized = authorizationManager.authorize(resource, john);
        assertTrue(authorized);
        assertFalse(((Cacheable) resource).requiresRefresh());

        authorized = authorizationManager.authorize(resource, mary);
        assertTrue(authorized);
        // now simulate remove of a role for the resource
        RuntimeResource resource2 = new TestRuntimeResource("test1234", "author");

        assertTrue(((Cacheable) resource2).requiresRefresh());

        authorized = authorizationManager.authorize(resource2, john);
        assertFalse(authorized);
View Full Code Here

        boolean refreshCache = false;
        if (resource instanceof Cacheable) {
            refreshCache = ((Cacheable) resource).requiresRefresh();
        }

        final RuntimeResource runtimeResource = (RuntimeResource) resource;

        RuntimeRestriction restriction = restrictions.get( runtimeResource.getSignatureId() );

        if ( restriction == null || refreshCache ) {
            restriction = addResource( runtimeResource );
        }
View Full Code Here

TOP

Related Classes of org.uberfire.security.authz.RuntimeResource

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.