Examples of decide()


Examples of org.springframework.security.access.vote.UnanimousBased.decide()

        UnanimousBased mgr = makeDecisionManager();

        List<ConfigAttribute> config = SecurityConfig.createList("ROLE_WE_DO_NOT_HAVE");

        try {
            mgr.decide(auth, new Object(), config);
            fail("Should have thrown AccessDeniedException");
        } catch (AccessDeniedException expected) {
            assertTrue(true);
        }
    }
View Full Code Here

Examples of org.springframework.security.access.vote.UnanimousBased.decide()

        TestingAuthenticationToken auth = makeTestTokenWithFooBarPrefix();
        UnanimousBased mgr = makeDecisionManagerWithFooBarPrefix();

        List<ConfigAttribute> config = SecurityConfig.createList(new String[]{"FOOBAR_1", "FOOBAR_2"});

        mgr.decide(auth, new Object(), config);
        assertTrue(true);
    }

    public void testThreeAbstainVotesDeniesAccessWithDefault() throws Exception {
        TestingAuthenticationToken auth = makeTestToken();
View Full Code Here

Examples of org.springframework.security.access.vote.UnanimousBased.decide()

        assertTrue(!mgr.isAllowIfAllAbstainDecisions()); // check default

        List<ConfigAttribute> config = SecurityConfig.createList("IGNORED_BY_ALL");

        try {
            mgr.decide(auth, new Object(), config);
            fail("Should have thrown AccessDeniedException");
        } catch (AccessDeniedException expected) {
            assertTrue(true);
        }
    }
View Full Code Here

Examples of org.springframework.security.access.vote.UnanimousBased.decide()

        mgr.setAllowIfAllAbstainDecisions(true);
        assertTrue(mgr.isAllowIfAllAbstainDecisions()); // check changed

        List<ConfigAttribute> config = SecurityConfig.createList("IGNORED_BY_ALL");

        mgr.decide(auth, new Object(), config);
        assertTrue(true);
    }

    public void testTwoAffirmativeVotesTwoAbstainVotesGrantsAccess() throws Exception {
        TestingAuthenticationToken auth = makeTestToken();
View Full Code Here

Examples of org.springframework.security.access.vote.UnanimousBased.decide()

        TestingAuthenticationToken auth = makeTestToken();
        UnanimousBased mgr = makeDecisionManager();

        List<ConfigAttribute> config = SecurityConfig.createList(new String[]{"ROLE_1", "ROLE_2"});

        mgr.decide(auth, new Object(), config);
        assertTrue(true);
    }
}
View Full Code Here

Examples of org.springframework.security.vote.AbstractAccessDecisionManager.decide()

        abstractAccessDecisionManager = new UnanimousBased();
      } else {
        throw new IllegalStateException("Unknown SecurityRule match type: " + rule.getComparisonType());
      }
      abstractAccessDecisionManager.setDecisionVoters(voters);
      abstractAccessDecisionManager.decide(authentication, object, config);
    }
  }

  /**
   * Convert SecurityRule into a form understood by Spring Security
View Full Code Here

Examples of org.springframework.security.web.access.channel.ChannelDecisionManagerImpl.decide()

        MockHttpServletResponse response = new MockHttpServletResponse();
        FilterInvocation fi = new FilterInvocation(request, response, mock(FilterChain.class));

        List<ConfigAttribute> cad = SecurityConfig.createList("xyz");

        cdm.decide(fi, cad);
        assertTrue(fi.getResponse().isCommitted());
    }

    public void testAnyChannelAttributeCausesProcessorsToBeSkipped() throws Exception {
        ChannelDecisionManagerImpl cdm = new ChannelDecisionManagerImpl();
View Full Code Here

Examples of org.springframework.security.web.access.channel.ChannelDecisionManagerImpl.decide()

        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpServletResponse response = new MockHttpServletResponse();
        FilterInvocation fi = new FilterInvocation(request, response, mock(FilterChain.class));

        cdm.decide(fi, SecurityConfig.createList(new String[]{"abc", "ANY_CHANNEL"}));
        assertFalse(fi.getResponse().isCommitted());
    }

    public void testDecideIteratesAllProcessorsIfNoneCommitAResponse() throws Exception {
        ChannelDecisionManagerImpl cdm = new ChannelDecisionManagerImpl();
View Full Code Here

Examples of org.springframework.security.web.access.channel.ChannelDecisionManagerImpl.decide()

        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpServletResponse response = new MockHttpServletResponse();
        FilterInvocation fi = new FilterInvocation(request, response, mock(FilterChain.class));

        cdm.decide(fi, SecurityConfig.createList("SOME_ATTRIBUTE_NO_PROCESSORS_SUPPORT"));
        assertFalse(fi.getResponse().isCommitted());
    }

    public void testDelegatesSupports() throws Exception {
        ChannelDecisionManagerImpl cdm = new ChannelDecisionManagerImpl();
View Full Code Here

Examples of org.springframework.security.web.access.channel.InsecureChannelProcessor.decide()

        MockHttpServletResponse response = new MockHttpServletResponse();
        FilterInvocation fi = new FilterInvocation(request, response, mock(FilterChain.class));

        InsecureChannelProcessor processor = new InsecureChannelProcessor();
        processor.decide(fi, SecurityConfig.createList(new String[]{"SOME_IGNORED_ATTRIBUTE", "REQUIRES_INSECURE_CHANNEL"}));

        assertTrue(fi.getResponse().isCommitted());
    }

    public void testDecideRejectsNulls() throws Exception {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.