]> source.dussan.org Git - jgit.git/commitdiff
Fix WWW-Authenticate auth-scheme comparison 76/1876/2
authorStefan Lay <stefan.lay@sap.com>
Wed, 10 Nov 2010 08:42:51 +0000 (09:42 +0100)
committerStefan Lay <stefan.lay@sap.com>
Wed, 10 Nov 2010 08:42:51 +0000 (09:42 +0100)
The auth-scheme token (like "Basic" or "Digest") is not specified in a
case sensitive way. RFC2617 (http://tools.ietf.org/html/rfc2617) specifies
in section 1.2 the use of a "case-insensitive token to identify the
authentication scheme". Jetty, for example, uses "basic" as token.

Change-Id: I635a94eb0a741abcb3e68195da6913753bdbd889
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java

index 06a4eb6a73670969763783166ec27b6062a31489..770294cacefa3be0ba0a8c0bd17e0660b8ac087f 100644 (file)
@@ -282,7 +282,7 @@ public class HttpClientTests extends HttpTestCase {
                                fail("connection opened even info/refs needs auth basic");
                        } catch (TransportException err) {
                                String exp = dumbAuthBasicURI + ": "
-                                               + JGitText.get().authenticationNotSupported;
+                                               + JGitText.get().notAuthorized;
                                assertEquals(exp, err.getMessage());
                        }
                } finally {
@@ -299,7 +299,7 @@ public class HttpClientTests extends HttpTestCase {
                                fail("connection opened even though service disabled");
                        } catch (TransportException err) {
                                String exp = smartAuthBasicURI + ": "
-                                               + JGitText.get().authenticationNotSupported;
+                                               + JGitText.get().notAuthorized;
                                assertEquals(exp, err.getMessage());
                        }
                } finally {
index 5a559abf1858a66aa5857e0a3f845eaae1ffe6b0..11178fc723ca6185770c03e5f6396f977a906d54 100644 (file)
@@ -85,9 +85,9 @@ abstract class HttpAuthMethod {
                        return NONE;
 
                String type = hdr.substring(0, sp);
-               if (Basic.NAME.equals(type))
+               if (Basic.NAME.equalsIgnoreCase(type))
                        return new Basic();
-               else if (Digest.NAME.equals(type))
+               else if (Digest.NAME.equalsIgnoreCase(type))
                        return new Digest(hdr.substring(sp + 1));
                else
                        return NONE;