Search in sources :

Example 6 with Token

use of org.springframework.security.core.token.Token in project spring-security by spring-projects.

the class KeyBasedPersistenceTokenServiceTests method testOperationWithEmptyRandomNumber.

@Test
public void testOperationWithEmptyRandomNumber() {
    KeyBasedPersistenceTokenService service = getService();
    service.setPseudoRandomNumberBytes(0);
    Token token = service.allocateToken("Hello:world:::");
    Token result = service.verifyToken(token.getKey());
    assertThat(result).isEqualTo(token);
}
Also used : KeyBasedPersistenceTokenService(org.springframework.security.core.token.KeyBasedPersistenceTokenService) Token(org.springframework.security.core.token.Token) DefaultToken(org.springframework.security.core.token.DefaultToken) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 DefaultToken (org.springframework.security.core.token.DefaultToken)6 KeyBasedPersistenceTokenService (org.springframework.security.core.token.KeyBasedPersistenceTokenService)6 Token (org.springframework.security.core.token.Token)6 Date (java.util.Date)2