Package org.springframework.security.cas.authentication

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


        cacheManager.shutdown();
    }

    @Test
    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"));

        // Check it gets removed from the cache
        cache.removeTicketFromCache(getToken());
        assertNull(cache.getByTicketId("ST-0-ER94xMJmn6pha35CQRoZ"));

        // Check it doesn't return values for null or unknown service tickets
        assertNull(cache.getByTicketId(null));
        assertNull(cache.getByTicketId("UNKNOWN_SERVICE_TICKET"));
    }
View Full Code Here


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

    @Test
    public void testStartupDetectsMissingCache() throws Exception {
        EhCacheBasedTicketCache cache = new EhCacheBasedTicketCache();

        try {
            cache.afterPropertiesSet();
            fail("Should have thrown IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            assertTrue(true);
        }

        Ehcache myCache = cacheManager.getCache("castickets");
        cache.setCache(myCache);
        assertEquals(myCache, cache.getCache());
    }
View Full Code Here

TOP

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

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.