Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcodagnone/1f3f736c672e3a3f8317 to your computer and use it in GitHub Desktop.
Save jcodagnone/1f3f736c672e3a3f8317 to your computer and use it in GitHub Desktop.
Jersey Client: Basic Authentication schema is case insensitive (rfc 2617 section 1.2)
diff --git a/core-client/src/main/java/org/glassfish/jersey/client/authentication/BasicAuthenticator.java b/core-client/src/main/java/org/glassfish/jersey/client/authentication/BasicAuthenticator.java
index 981abfa..0e692e7 100644
--- a/core-client/src/main/java/org/glassfish/jersey/client/authentication/BasicAuthenticator.java
+++ b/core-client/src/main/java/org/glassfish/jersey/client/authentication/BasicAuthenticator.java
@@ -115,7 +115,7 @@ final class BasicAuthenticator {
*/
public boolean filterResponseAndAuthenticate(ClientRequestContext request, ClientResponseContext response) {
final String authenticate = response.getHeaders().getFirst(HttpHeaders.WWW_AUTHENTICATE);
- if (authenticate != null && authenticate.trim().startsWith("Basic")) {
+ if (authenticate != null && authenticate.trim().toUpperCase().startsWith("BASIC")) {
HttpAuthenticationFilter.Credentials credentials = HttpAuthenticationFilter
.getCredentials(request, defaultCredentials, HttpAuthenticationFilter.Type.BASIC);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment