made user codes case insensitive

pull/972/merge
Justin Richer 8 years ago
parent d317cf5024
commit 45ea899de8

@ -57,8 +57,8 @@ public class DefaultDeviceCodeService implements DeviceCodeService {
// create a device code, should be big and random // create a device code, should be big and random
String deviceCode = UUID.randomUUID().toString(); String deviceCode = UUID.randomUUID().toString();
// create a user code, should be random but small and typable // create a user code, should be random but small and typable, and always uppercase (lookup is case insensitive)
String userCode = randomGenerator.generate(); String userCode = randomGenerator.generate().toUpperCase();
DeviceCode dc = new DeviceCode(deviceCode, userCode, requestedScopes, client.getClientId(), parameters); DeviceCode dc = new DeviceCode(deviceCode, userCode, requestedScopes, client.getClientId(), parameters);
@ -76,7 +76,8 @@ public class DefaultDeviceCodeService implements DeviceCodeService {
*/ */
@Override @Override
public DeviceCode lookUpByUserCode(String userCode) { public DeviceCode lookUpByUserCode(String userCode) {
return repository.getByUserCode(userCode); // always up-case the code for lookup
return repository.getByUserCode(userCode.toUpperCase());
} }
/* (non-Javadoc) /* (non-Javadoc)

Loading…
Cancel
Save