Examples of TestingAuthenticationToken


Examples of org.springframework.security.authentication.TestingAuthenticationToken

    }

    @Test
    @Transactional
    public void cumulativePermissions() {
       Authentication auth = new TestingAuthenticationToken("ben", "ignored", "ROLE_ADMINISTRATOR");
       auth.setAuthenticated(true);
       SecurityContextHolder.getContext().setAuthentication(auth);

       ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(110));
       MutableAcl topParent = jdbcMutableAclService.createAcl(topParentOid);
View Full Code Here

Examples of org.springframework.security.authentication.TestingAuthenticationToken

        getRoot().getAuthentication();
    }

    @Test
    public void getRootObjectSecurityContextHolderAuthentication() {
        TestingAuthenticationToken authentication = new TestingAuthenticationToken("user", "password", "ROLE_USER");
        SecurityContextHolder.getContext().setAuthentication(authentication);

        assertThat(getRoot().getAuthentication()).isSameAs(authentication);
    }
View Full Code Here

Examples of org.springframework.security.authentication.TestingAuthenticationToken

        assertThat(getRoot().getAuthentication()).isSameAs(authentication);
    }

    @Test
    public void getRootObjectExplicitAuthenticationOverridesSecurityContextHolder() {
        TestingAuthenticationToken explicit = new TestingAuthenticationToken("explicit", "password", "ROLE_EXPLICIT");
        securityExtension = new SecurityEvaluationContextExtension(explicit);

        TestingAuthenticationToken authentication = new TestingAuthenticationToken("user", "password", "ROLE_USER");
        SecurityContextHolder.getContext().setAuthentication(authentication);

        assertThat(getRoot().getAuthentication()).isSameAs(explicit);
    }
View Full Code Here

Examples of org.springframework.security.authentication.TestingAuthenticationToken

        assertThat(element.getAllValues().get(0).getObjectValue()).isEqualTo(acl);
    }

    @Test
    public void putInCacheAclWithParent() throws Exception {
        Authentication auth = new TestingAuthenticationToken("user", "password", "ROLE_GENERAL");
        auth.setAuthenticated(true);
        SecurityContextHolder.getContext().setAuthentication(auth);

        ObjectIdentity identityParent = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(2));
        AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
                new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority("ROLE_AUDITING"),
View Full Code Here

Examples of org.springframework.security.authentication.TestingAuthenticationToken

        assertThat(getRoot().getAuthentication()).isSameAs(explicit);
    }

    @Test
    public void getRootObjectExplicitAuthentication() {
        TestingAuthenticationToken explicit = new TestingAuthenticationToken("explicit", "password", "ROLE_EXPLICIT");
        securityExtension = new SecurityEvaluationContextExtension(explicit);

        assertThat(getRoot().getAuthentication()).isSameAs(explicit);
    }
View Full Code Here

Examples of org.springframework.security.authentication.TestingAuthenticationToken

        SecurityContextHolder.clearContext();
    }

    @Test
    public void testSecurityCheckNoACEs() throws Exception {
        Authentication auth = new TestingAuthenticationToken("user", "password","ROLE_GENERAL","ROLE_AUDITING","ROLE_OWNERSHIP");
        auth.setAuthenticated(true);
        SecurityContextHolder.getContext().setAuthentication(auth);

        ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, new Long(100));
        AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
                new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority("ROLE_AUDITING"),
View Full Code Here

Examples of org.springframework.security.authentication.TestingAuthenticationToken

    }

    @Test
    public void testSecurityCheckWithMultipleACEs() throws Exception {
        // Create a simple authentication with ROLE_GENERAL
        Authentication auth = new TestingAuthenticationToken("user", "password", "ROLE_GENERAL");
        auth.setAuthenticated(true);
        SecurityContextHolder.getContext().setAuthentication(auth);

        ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, new Long(100));
        // Authorization strategy will require a different role for each access
        AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
View Full Code Here

Examples of org.springframework.security.authentication.TestingAuthenticationToken

    }

    @Test
    public void testSecurityCheckWithInheritableACEs() throws Exception {
        // Create a simple authentication with ROLE_GENERAL
        Authentication auth = new TestingAuthenticationToken("user", "password", "ROLE_GENERAL");
        auth.setAuthenticated(true);
        SecurityContextHolder.getContext().setAuthentication(auth);

        ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, 100);
        // Authorization strategy will require a different role for each access
        AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
View Full Code Here

Examples of org.springframework.security.authentication.TestingAuthenticationToken

    }

    @SuppressWarnings("deprecation")
    @Test
    public void testSecurityCheckPrincipalOwner() throws Exception {
        Authentication auth = new TestingAuthenticationToken("user", "password", "ROLE_ONE");
        auth.setAuthenticated(true);
        SecurityContextHolder.getContext().setAuthentication(auth);

        ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, 100);
        AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
                new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority("ROLE_AUDITING"),
View Full Code Here

Examples of org.springframework.security.authentication.TestingAuthenticationToken

    @Test
    public void cacheOperationsAclWithParent() throws Exception {
        Cache cache = getCache();
        Map realCache = (Map) cache.getNativeCache();

        Authentication auth = new TestingAuthenticationToken("user", "password", "ROLE_GENERAL");
        auth.setAuthenticated(true);
        SecurityContextHolder.getContext().setAuthentication(auth);

        ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(1));
        ObjectIdentity identityParent = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(2));
        AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
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.