OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/android/http_auth_negotiate_android.h" | 5 #include "net/android/http_auth_negotiate_android.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 bool HttpAuthNegotiateAndroid::NeedsIdentity() const { | 80 bool HttpAuthNegotiateAndroid::NeedsIdentity() const { |
81 return false; | 81 return false; |
82 } | 82 } |
83 | 83 |
84 bool HttpAuthNegotiateAndroid::AllowsExplicitCredentials() const { | 84 bool HttpAuthNegotiateAndroid::AllowsExplicitCredentials() const { |
85 return false; | 85 return false; |
86 } | 86 } |
87 | 87 |
88 HttpAuth::AuthorizationResult HttpAuthNegotiateAndroid::ParseChallenge( | 88 HttpAuth::AuthorizationResult HttpAuthNegotiateAndroid::ParseChallenge( |
89 net::HttpAuthChallengeTokenizer* tok) { | 89 const HttpAuthChallengeTokenizer& tok) { |
90 if (first_challenge_) { | 90 if (first_challenge_) { |
91 first_challenge_ = false; | 91 first_challenge_ = false; |
92 return net::ParseFirstRoundChallenge("negotiate", tok); | 92 return ParseFirstRoundChallenge("negotiate", tok); |
93 } | 93 } |
94 std::string decoded_auth_token; | 94 std::string decoded_auth_token; |
95 return net::ParseLaterRoundChallenge("negotiate", tok, &server_auth_token_, | 95 return ParseLaterRoundChallenge("negotiate", tok, &server_auth_token_, |
96 &decoded_auth_token); | 96 &decoded_auth_token); |
97 } | 97 } |
98 | 98 |
99 int HttpAuthNegotiateAndroid::GenerateAuthToken( | 99 int HttpAuthNegotiateAndroid::GenerateAuthToken( |
100 const AuthCredentials* credentials, | 100 const AuthCredentials* credentials, |
101 const std::string& spn, | 101 const std::string& spn, |
102 std::string* auth_token, | 102 std::string* auth_token, |
103 const net::CompletionCallback& callback) { | 103 const net::CompletionCallback& callback) { |
104 DCHECK(auth_token); | 104 DCHECK(auth_token); |
105 DCHECK(completion_callback_.is_null()); | 105 DCHECK(completion_callback_.is_null()); |
106 DCHECK(!callback.is_null()); | 106 DCHECK(!callback.is_null()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 const std::string& raw_token) { | 145 const std::string& raw_token) { |
146 DCHECK(auth_token_); | 146 DCHECK(auth_token_); |
147 DCHECK(!completion_callback_.is_null()); | 147 DCHECK(!completion_callback_.is_null()); |
148 if (result == OK) | 148 if (result == OK) |
149 *auth_token_ = "Negotiate " + raw_token; | 149 *auth_token_ = "Negotiate " + raw_token; |
150 base::ResetAndReturn(&completion_callback_).Run(result); | 150 base::ResetAndReturn(&completion_callback_).Run(result); |
151 } | 151 } |
152 | 152 |
153 } // namespace android | 153 } // namespace android |
154 } // namespace net | 154 } // namespace net |
OLD | NEW |