
@Component public class TokenGenerator extends Object
| Modifier and Type | Field and Description |
|---|---|
private static char[] |
ALLOWED_TOKEN_CHARACTERS
Only allow letters and numbers, no symbols.
|
private Random |
random |
private static int |
TOKEN_LENGTH
This makes the possible combinations higher than a 256-bit key.
|
| Constructor and Description |
|---|
TokenGenerator() |
| Modifier and Type | Method and Description |
|---|---|
void |
initializeRandom()
Initializes the random source.
|
String |
newToken()
Provides a new string useful for keys and access tokens.
|
private static final char[] ALLOWED_TOKEN_CHARACTERS
private static final int TOKEN_LENGTH
private Random random
@PostConstruct public void initializeRandom() throws NoSuchAlgorithmException
NoSuchAlgorithmException - this should not happen.public String newToken()
Copyright © 2012–2018 Trajano. All rights reserved.