Skip to content

Commit 97a5246

Browse files
committed
#8: Default Digest Algorithm: 2nd try
1 parent 4a808ec commit 97a5246

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import me.vzhilin.auth.digester.Digester;
44
import me.vzhilin.auth.digester.Ha1;
55
import me.vzhilin.auth.digester.Ha1Supplier;
6-
import me.vzhilin.auth.parser.ChallengeResponse;
7-
import me.vzhilin.auth.parser.QopOptions;
6+
import me.vzhilin.auth.parser.*;
87

98
import java.util.Set;
109

@@ -35,7 +34,9 @@ public synchronized void onResponseReceived(ChallengeResponse response, int http
3534
digester.resetNonceCount();
3635
}
3736

38-
digester.setAlgorithm(response.getAlgorithm());
37+
DigestAlgorithm algorithm = response.getAlgorithm();
38+
digester.setAlgorithm(algorithm == null ? DigestAlgorithm.MD5 : algorithm);
39+
3940
digester.setQop(chooseQop(response));
4041

4142
this.opaque = response.getOpaque();
@@ -52,7 +53,7 @@ private QopOptions chooseQop(ChallengeResponse challenge) {
5253
return QopOptions.AUTH_INT;
5354
}
5455

55-
return null;
56+
return QopOptions.AUTH;
5657
}
5758

5859
public String autorizationHeader(String method, String uri) {

0 commit comments

Comments
 (0)