Skip to content

Commit 3624e89

Browse files
committed
#8: fix QoP
1 parent 34f10c6 commit 3624e89

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/main/java/me/vzhilin/auth/DigestAuthenticationHeader.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package me.vzhilin.auth;
22

33
import me.vzhilin.auth.digester.Digester;
4+
import me.vzhilin.auth.parser.QopOptions;
45

56
public class DigestAuthenticationHeader {
67
private final String username;
@@ -22,7 +23,8 @@ public DigestAuthenticationHeader(String opaque, String uri, String username, St
2223
this.uri = uri;
2324
this.opaque = opaque;
2425
this.algorithm = digester.getAlgorithm().toString();
25-
this.qop = digester.getQop().toString();
26+
QopOptions qop = digester.getQop();
27+
this.qop = qop == null ? null : qop.toString();
2628
this.nc = digester.getNonceCountAsString();
2729
this.cnonce = digester.getCnonce();
2830
}
@@ -37,7 +39,7 @@ public String toString() {
3739
sb.append("uri=\"").append(uri).append("\",");
3840
if (algorithm != null) sb.append("algorithm=").append(algorithm).append(",");
3941
sb.append("response=\"").append(response).append("\",");
40-
sb.append("qop=").append(qop).append(",");
42+
if (qop != null) sb.append("qop=").append(qop).append(",");
4143
sb.append("nc=").append(nc).append(",");
4244
sb.append("cnonce=\"").append(cnonce).append("\",");
4345
sb.setLength(sb.length() - 1);

src/main/java/me/vzhilin/auth/DigestAuthenticator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private QopOptions chooseQop(ChallengeResponse challenge) {
5353
return QopOptions.AUTH_INT;
5454
}
5555

56-
return QopOptions.AUTH;
56+
return null;
5757
}
5858

5959
public String authorizationHeader(String method, String uri) {

0 commit comments

Comments
 (0)