Fix exception for empty basic auth header token

fixes spring-projectsgh-7976
This commit is contained in:
Zeeshan Adnan
2020-03-13 02:32:19 +06:00
committed by Eleftheria Stein-Kousathana
parent 3d5a1522d6
commit 935c547dde
3 changed files with 28 additions and 0 deletions

View File

@@ -87,6 +87,10 @@ public class BasicAuthenticationConverter implements AuthenticationConverter {
return null;
}
if (header.equalsIgnoreCase(AUTHENTICATION_SCHEME_BASIC)) {
throw new BadCredentialsException("Empty basic authentication token");
}
byte[] base64Token = header.substring(6).getBytes(StandardCharsets.UTF_8);
byte[] decoded;
try {