Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#529 DIGEST Auth does not work if server doesn't indicate algorithm + fix in URI usage in Netty provider. #530

Merged
merged 1 commit into from Apr 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main/java/com/ning/http/client/Realm.java
Expand Up @@ -22,8 +22,6 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import com.ning.http.util.MiscUtil;

/**
* This class is required when authentication is needed. The class support DIGEST and BASIC.
*/
Expand Down Expand Up @@ -433,7 +431,10 @@ public RealmBuilder setUsePreemptiveAuth(boolean usePreemptiveAuth) {
public RealmBuilder parseWWWAuthenticateHeader(String headerLine) {
setRealmName(match(headerLine, "realm"));
setNonce(match(headerLine, "nonce"));
setAlgorithm(match(headerLine, "algorithm"));
String algorithm = match(headerLine, "algorithm");
if (isNonEmpty(algorithm)) {
setAlgorithm(algorithm);
}
setOpaque(match(headerLine, "opaque"));
setQop(match(headerLine, "qop"));
if (isNonEmpty(getNonce())) {
Expand Down
Expand Up @@ -2107,7 +2107,7 @@ public void handle(final ChannelHandlerContext ctx, final MessageEvent e) throws
.parseWWWAuthenticateHeader(wwwAuth.get(0)).build();
}

final Realm nr = new Realm.RealmBuilder().clone(newRealm).setUri(request.getUrl()).build();
final Realm nr = new Realm.RealmBuilder().clone(newRealm).setUri(request.getURI().getPath()).build();

log.debug("Sending authentication to {}", request.getUrl());
AsyncCallable ac = new AsyncCallable(future) {
Expand Down