use of org.springframework.security.core.token.SecureRandomFactoryBean in project spring-security by spring-projects.
the class SecureRandomFactoryBeanTests method testCreatesUsingDefaults.
@Test
public void testCreatesUsingDefaults() throws Exception {
SecureRandomFactoryBean factory = new SecureRandomFactoryBean();
Object result = factory.getObject();
assertThat(result).isInstanceOf(SecureRandom.class);
int rnd = ((SecureRandom) result).nextInt();
assertThat(rnd).isNotEqualTo(0);
}
use of org.springframework.security.core.token.SecureRandomFactoryBean in project spring-security by spring-projects.
the class SecureRandomFactoryBeanTests method testCreatesUsingSeed.
@Test
public void testCreatesUsingSeed() throws Exception {
SecureRandomFactoryBean factory = new SecureRandomFactoryBean();
Resource resource = new ClassPathResource("org/springframework/security/core/token/SecureRandomFactoryBeanTests.class");
assertThat(resource).isNotNull();
factory.setSeed(resource);
Object result = factory.getObject();
assertThat(result).isInstanceOf(SecureRandom.class);
int rnd = ((SecureRandom) result).nextInt();
assertThat(rnd).isNotEqualTo(0);
}
use of org.springframework.security.core.token.SecureRandomFactoryBean in project spring-security by spring-projects.
the class SecureRandomFactoryBeanTests method testObjectType.
@Test
public void testObjectType() {
SecureRandomFactoryBean factory = new SecureRandomFactoryBean();
assertThat(factory.getObjectType()).isEqualTo(SecureRandom.class);
}
use of org.springframework.security.core.token.SecureRandomFactoryBean in project spring-security by spring-projects.
the class KeyBasedPersistenceTokenServiceTests method getService.
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);
}
return service;
}
use of org.springframework.security.core.token.SecureRandomFactoryBean in project spring-security by spring-projects.
the class SecureRandomFactoryBeanTests method testIsSingleton.
@Test
public void testIsSingleton() {
SecureRandomFactoryBean factory = new SecureRandomFactoryBean();
assertThat(factory.isSingleton()).isFalse();
}
Aggregations