Package org.springframework.security.cas.authentication

Examples of org.springframework.security.cas.authentication.CasAuthenticationToken


    public void testCacheOperation() throws Exception {
        EhCacheBasedTicketCache cache = new EhCacheBasedTicketCache();
        cache.setCache(cacheManager.getCache("castickets"));
        cache.afterPropertiesSet();

        final CasAuthenticationToken token = getToken();

        // Check it gets stored in the cache
        cache.putTicketInCache(token);
        assertEquals(token, cache.getByTicketId("ST-0-ER94xMJmn6pha35CQRoZ"));
View Full Code Here


        assertNull(cache.getByTicketId("test"));
    }

    @Test
    public void testInsertAndGet() {
        final CasAuthenticationToken token = getToken();
        cache.putTicketInCache(token);
        assertNull(cache.getByTicketId((String) token.getCredentials()));
    }
View Full Code Here

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        // NOTE: The CasAuthenticationToken can also be obtained using SecurityContextHolder.getContext().getAuthentication()
        final CasAuthenticationToken token = (CasAuthenticationToken) request.getUserPrincipal();
        // proxyTicket could be reused to make calls to to the CAS service even if the target url differs
        final String proxyTicket = token.getAssertion().getPrincipal().getProxyTicketFor(targetUrl);

        // Make a remote call to ourself. This is a bit silly, but it works well to demonstrate how to use proxy tickets.
        final String serviceUrl = targetUrl+"?ticket="+URLEncoder.encode(proxyTicket, "UTF-8");
        String proxyResponse = CommonUtils.getResponseFromServer(serviceUrl, "UTF-8");
View Full Code Here

        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

TOP

Related Classes of org.springframework.security.cas.authentication.CasAuthenticationToken

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.