Skip to content

Commit 45ea899

Browse files
committed
made user codes case insensitive
1 parent d317cf5 commit 45ea899

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

openid-connect-server/src/main/java/org/mitre/oauth2/service/impl/DefaultDeviceCodeService.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public DeviceCode createNewDeviceCode(Set<String> requestedScopes, ClientDetails
5757
// create a device code, should be big and random
5858
String deviceCode = UUID.randomUUID().toString();
5959

60-
// create a user code, should be random but small and typable
61-
String userCode = randomGenerator.generate();
60+
// create a user code, should be random but small and typable, and always uppercase (lookup is case insensitive)
61+
String userCode = randomGenerator.generate().toUpperCase();
6262

6363
DeviceCode dc = new DeviceCode(deviceCode, userCode, requestedScopes, client.getClientId(), parameters);
6464

@@ -76,7 +76,8 @@ public DeviceCode createNewDeviceCode(Set<String> requestedScopes, ClientDetails
7676
*/
7777
@Override
7878
public DeviceCode lookUpByUserCode(String userCode) {
79-
return repository.getByUserCode(userCode);
79+
// always up-case the code for lookup
80+
return repository.getByUserCode(userCode.toUpperCase());
8081
}
8182

8283
/* (non-Javadoc)

0 commit comments

Comments
 (0)