Adjustment to generate longer codes

RandomValueStringGenerator default constructor creates a code of length six only. The RFC 6819 (OAuth 2.0 Threat Model and Security Considerations) suggests (5.1.4.2.2.  Use High Entropy for Secrets) that secrets that aren't used by humans (e.g. client secrets or token handles) have a reasonable level of enthropy. They propose a token lengths of at least 128 bits. Since the RandomValueStringGenerator only uses case sensitive alpha numeric symbols, 22 symbols are needed to achieve an enthropy >=128 bits.
pull/1259/head
sbke 2017-06-28 14:20:11 +02:00 committed by GitHub
parent ef01d3032e
commit 8b4e461748
1 changed files with 1 additions and 1 deletions

View File

@ -57,7 +57,7 @@ public class DefaultOAuth2AuthorizationCodeService implements AuthorizationCodeS
private int authCodeExpirationSeconds = 60 * 5; // expire in 5 minutes by default
private RandomValueStringGenerator generator = new RandomValueStringGenerator();
private RandomValueStringGenerator generator = new RandomValueStringGenerator(22);
/**
* Generate a random authorization code and create an AuthorizationCodeEntity,