Package org.jasig.cas.client.validation

Examples of org.jasig.cas.client.validation.AssertionImpl


        assertTrue(!token1.equals(token2));
    }

    public void testNotEqualsDueToDifferentAuthenticationClass() {
        final Assertion assertion = new AssertionImpl("test");

        CasAuthenticationToken token1 = new CasAuthenticationToken("key", makeUserDetails(), "Password", ROLES,
                makeUserDetails(), assertion);

        UsernamePasswordAuthenticationToken token2 = new UsernamePasswordAuthenticationToken("Test", "Password", ROLES);
View Full Code Here


        UsernamePasswordAuthenticationToken token2 = new UsernamePasswordAuthenticationToken("Test", "Password", ROLES);
        assertTrue(!token1.equals(token2));
    }

    public void testNotEqualsDueToKey() {
        final Assertion assertion = new AssertionImpl("test");

        CasAuthenticationToken token1 = new CasAuthenticationToken("key", makeUserDetails(), "Password", ROLES,
                makeUserDetails(), assertion);

        CasAuthenticationToken token2 = new CasAuthenticationToken("DIFFERENT_KEY", makeUserDetails(), "Password",
View Full Code Here

        assertTrue(!token1.equals(token2));
    }

    public void testNotEqualsDueToAssertion() {
        final Assertion assertion = new AssertionImpl("test");
        final Assertion assertion2 = new AssertionImpl("test");

        CasAuthenticationToken token1 = new CasAuthenticationToken("key", makeUserDetails(), "Password", ROLES,
                makeUserDetails(), assertion);

        CasAuthenticationToken token2 = new CasAuthenticationToken("key", makeUserDetails(), "Password", ROLES,
View Full Code Here

        assertTrue(!token1.equals(token2));
    }

    public void testSetAuthenticated() {
        final Assertion assertion = new AssertionImpl("test");
        CasAuthenticationToken token = new CasAuthenticationToken("key", makeUserDetails(), "Password", ROLES,
                makeUserDetails(), assertion);
        assertTrue(token.isAuthenticated());
        token.setAuthenticated(false);
        assertTrue(!token.isAuthenticated());
View Full Code Here

        token.setAuthenticated(false);
        assertTrue(!token.isAuthenticated());
    }

    public void testToString() {
        final Assertion assertion = new AssertionImpl("test");
        CasAuthenticationToken token = new CasAuthenticationToken("key", makeUserDetails(), "Password",ROLES,
                makeUserDetails(), assertion);
        String result = token.toString();
        assertTrue(result.lastIndexOf("Credentials (Service/Proxy Ticket):") != -1);
    }
View Full Code Here

    protected CasAuthenticationToken getToken() {
        List<String> proxyList = new ArrayList<String>();
        proxyList.add("https://localhost/newPortal/j_spring_cas_security_check");

        User user = new User("rod", "password", true, true, true, true, AuthorityUtils.createAuthorityList("ROLE_ONE", "ROLE_TWO"));
        final Assertion assertion = new AssertionImpl("rod");

        return new CasAuthenticationToken("key", user, "ST-0-ER94xMJmn6pha35CQRoZ",
                AuthorityUtils.createAuthorityList("ROLE_ONE", "ROLE_TWO"), user, assertion);
    }
View Full Code Here

        final HttpServletRequestWrapperFilter filter = new HttpServletRequestWrapperFilter();
        filter.init(new MockFilterConfig());
        final MockHttpServletRequest request = new MockHttpServletRequest();
        final MockHttpSession session = new MockHttpSession();

        session.setAttribute(AbstractCasFilter.CONST_CAS_ASSERTION, new AssertionImpl("test"));
        request.setSession(session);

        filter.doFilter(request, new MockHttpServletResponse(), createFilterChain());
        assertEquals("test", this.mockRequest.getRemoteUser());
View Full Code Here

        filter.init(config);

        final Map<String, Object> attributes = new HashMap<String, Object>();
        attributes.put("memberOf", "administrators");
        final AttributePrincipal principal = new AttributePrincipalImpl("alice", attributes);
        session.setAttribute(AbstractCasFilter.CONST_CAS_ASSERTION, new AssertionImpl(principal));

        request.setSession(session);

        filter.doFilter(request, new MockHttpServletResponse(), createFilterChain());
        assertEquals("alice", this.mockRequest.getRemoteUser());
View Full Code Here

        filter.init(config);

        final Map<String, Object> attributes = new HashMap<String, Object>();
        attributes.put("groupMembership", Arrays.asList(new Object[] { "animals", "ducks" }));
        final AttributePrincipal principal = new AttributePrincipalImpl("daffy", attributes);
        session.setAttribute(AbstractCasFilter.CONST_CAS_ASSERTION, new AssertionImpl(principal));

        request.setSession(session);

        filter.doFilter(request, new MockHttpServletResponse(), createFilterChain());
        assertEquals("daffy", this.mockRequest.getRemoteUser());
View Full Code Here

                // nothing to do
            }
        };

        request.setSession(session);
        session.setAttribute(AbstractCasFilter.CONST_CAS_ASSERTION, new AssertionImpl("test"));
        this.filter.doFilter(request, response, filterChain);

        assertNull(response.getRedirectedUrl());
    }
View Full Code Here

TOP

Related Classes of org.jasig.cas.client.validation.AssertionImpl

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.