Search in sources :

Example 1 with RequestSecurityProcessorChain

use of org.craftercms.security.processors.RequestSecurityProcessorChain in project engine by craftercms.

the class ConfigAwareUrlAccessRestrictionCheckingProcessorTest method testProcessRequest.

@Test(expected = AccessDeniedException.class)
public void testProcessRequest() throws Exception {
    RequestContext requestContext = RequestContext.getCurrent();
    RequestSecurityProcessorChain chain = mock(RequestSecurityProcessorChain.class);
    SecurityUtils.setAuthentication(requestContext.getRequest(), new DefaultAuthentication(ObjectId.get().toString(), new Profile()));
    processor.processRequest(requestContext, chain);
}
Also used : DefaultAuthentication(org.craftercms.security.authentication.impl.DefaultAuthentication) RequestSecurityProcessorChain(org.craftercms.security.processors.RequestSecurityProcessorChain) RequestContext(org.craftercms.commons.http.RequestContext) Profile(org.craftercms.profile.api.Profile) Test(org.junit.Test)

Aggregations

RequestContext (org.craftercms.commons.http.RequestContext)1 Profile (org.craftercms.profile.api.Profile)1 DefaultAuthentication (org.craftercms.security.authentication.impl.DefaultAuthentication)1 RequestSecurityProcessorChain (org.craftercms.security.processors.RequestSecurityProcessorChain)1 Test (org.junit.Test)1