Package org.springframework.security.core.token

Examples of org.springframework.security.core.token.SecureRandomFactoryBean


*
*/
public class SecureRandomFactoryBeanTests {
    @Test
    public void testObjectType() {
        SecureRandomFactoryBean factory = new SecureRandomFactoryBean();
        Assert.assertEquals(SecureRandom.class, factory.getObjectType());
    }
View Full Code Here


        Assert.assertEquals(SecureRandom.class, factory.getObjectType());
    }

    @Test
    public void testIsSingleton() {
        SecureRandomFactoryBean factory = new SecureRandomFactoryBean();
        Assert.assertFalse(factory.isSingleton());
    }
View Full Code Here

        Assert.assertFalse(factory.isSingleton());
    }

    @Test
    public void testCreatesUsingDefaults() throws Exception {
        SecureRandomFactoryBean factory = new SecureRandomFactoryBean();
        Object result = factory.getObject();
        Assert.assertTrue(result instanceof SecureRandom);
        int rnd = ((SecureRandom)result).nextInt();
        Assert.assertTrue(rnd != 0);
    }
View Full Code Here

        Assert.assertTrue(rnd != 0);
    }

    @Test
    public void testCreatesUsingSeed() throws Exception {
        SecureRandomFactoryBean factory = new SecureRandomFactoryBean();
        Resource resource = new ClassPathResource("org/springframework/security/core/token/SecureRandomFactoryBeanTests.class");
        Assert.assertNotNull(resource);
        factory.setSeed(resource);
        Object result = factory.getObject();
        Assert.assertTrue(result instanceof SecureRandom);
        int rnd = ((SecureRandom)result).nextInt();
        Assert.assertTrue(rnd != 0);
    }
View Full Code Here

*
*/
public class KeyBasedPersistenceTokenServiceTests {

    private KeyBasedPersistenceTokenService getService() {
        SecureRandomFactoryBean fb = new SecureRandomFactoryBean();
        KeyBasedPersistenceTokenService service = new KeyBasedPersistenceTokenService();
        service.setServerSecret("MY:SECRET$$$#");
        service.setServerInteger(Integer.valueOf(454545));
        try {
            SecureRandom rnd = (SecureRandom) fb.getObject();
            service.setSecureRandom(rnd);
            service.afterPropertiesSet();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

TOP

Related Classes of org.springframework.security.core.token.SecureRandomFactoryBean

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.