|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright 2020-2023 the original author or authors.
|
|
|
+ * Copyright 2020-2024 the original author or authors.
|
|
|
*
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
* you may not use this file except in compliance with the License.
|
|
@@ -17,6 +17,7 @@ package org.springframework.security.oauth2.server.authorization.web.authenticat
|
|
|
|
|
|
import java.util.Collections;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.Locale;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
@@ -110,14 +111,14 @@ final class OAuth2EndpointUtils {
|
|
|
|
|
|
static String normalizeUserCode(String userCode) {
|
|
|
Assert.hasText(userCode, "userCode cannot be empty");
|
|
|
- StringBuilder sb = new StringBuilder(userCode.toUpperCase().replaceAll("[^A-Z\\d]+", ""));
|
|
|
+ StringBuilder sb = new StringBuilder(userCode.toUpperCase(Locale.ENGLISH).replaceAll("[^A-Z\\d]+", ""));
|
|
|
Assert.isTrue(sb.length() == 8, "userCode must be exactly 8 alpha/numeric characters");
|
|
|
sb.insert(4, '-');
|
|
|
return sb.toString();
|
|
|
}
|
|
|
|
|
|
static boolean validateUserCode(String userCode) {
|
|
|
- return (userCode != null && userCode.toUpperCase().replaceAll("[^A-Z\\d]+", "").length() == 8);
|
|
|
+ return (userCode != null && userCode.toUpperCase(Locale.ENGLISH).replaceAll("[^A-Z\\d]+", "").length() == 8);
|
|
|
}
|
|
|
|
|
|
}
|