cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject cxf git commit: [CXF-6748]the qop, nc, algorithm parameter in http auth header must not be enclosed between doble quotation
Date Fri, 15 Jan 2016 02:26:35 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes dac3e9e25 -> b0035ade0


[CXF-6748]the qop,nc,algorithm parameter in http auth header must not be enclosed between
doble quotation

(cherry picked from commit bf4f4c89b61640faa41dbac68cf591cb923eb144)


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b0035ade
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b0035ade
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b0035ade

Branch: refs/heads/3.1.x-fixes
Commit: b0035ade0042160b77b4848939f58efe9a77d6c7
Parents: dac3e9e
Author: Freeman Fang <freeman.fang@gmail.com>
Authored: Thu Jan 14 17:23:43 2016 +0800
Committer: Freeman Fang <freeman.fang@gmail.com>
Committed: Fri Jan 15 10:26:21 2016 +0800

----------------------------------------------------------------------
 .../cxf/transport/http/auth/HttpAuthHeader.java | 26 +++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b0035ade/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthHeader.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthHeader.java
b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthHeader.java
index f9e96d9..0b331ed 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthHeader.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthHeader.java
@@ -84,7 +84,13 @@ public final class HttpAuthHeader {
                 if (!first) {
                     builder.append(", ");
                 }
-                builder.append(entry.getKey() + "=\"" + param + "\"");
+                if (entry.getKey().equals("nc") 
+                    || entry.getKey().equals("qop")
+                    || entry.getKey().equals("algorithm")) {
+                    builder.append(entry.getKey() + "=" + param + "");
+                } else {
+                    builder.append(entry.getKey() + "=\"" + param + "\"");
+                }
                 first = false;
             }
         }
@@ -99,14 +105,28 @@ public final class HttpAuthHeader {
             tok.quoteChar('\'');
             tok.whitespaceChars('=', '=');
             tok.whitespaceChars(',', ',');
-            
+
             while (tok.nextToken() != StreamTokenizer.TT_EOF) {
                 String key = tok.sval;
                 if (tok.nextToken() == StreamTokenizer.TT_EOF) {
                     map.put(key, null);
                     return map;
                 }
-                String value = tok.sval;
+                String value = null;
+                if ("nc".equals(key)) {
+                    //nc is a 8 length HEX number so need get it as number
+                    value = String.valueOf(tok.nval);
+                    if (value.indexOf(".") > 0) {
+                        value = value.substring(0, value.indexOf("."));
+                    }
+                    String pad = "";
+                    for (int i = 0; i < 8 - value.length(); i++) {
+                        pad = pad + "0";
+                    }
+                    value = pad + value;
+                } else {
+                    value = tok.sval;
+                }
                 map.put(key, value);
             }
         } catch (IOException ex) {


Mime
View raw message