Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_HTTP_HTTP_ANDROID_AUTH_NEGOTIATE_H_ | |
| 6 #define NET_HTTP_HTTP_ANDROID_AUTH_NEGOTIATE_H_ | |
| 7 | |
| 8 #include <jni.h> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/android/jni_android.h" | |
| 12 #include "base/macros.h" | |
| 13 | |
| 14 #include "net/base/completion_callback.h" | |
| 15 #include "net/http/http_auth.h" | |
| 16 | |
| 17 namespace net { | |
| 18 | |
| 19 class HttpAuthChallengeTokenizer; | |
| 20 | |
| 21 namespace android { | |
| 22 | |
| 23 class NET_EXPORT_PRIVATE AndroidAuthNegotiate { | |
| 24 public: | |
| 25 AndroidAuthNegotiate(const std::string& account_type, | |
| 26 const std::string& scheme); | |
| 27 ~AndroidAuthNegotiate(); | |
| 28 bool Init(); | |
| 29 | |
| 30 bool NeedsIdentity() const; | |
| 31 | |
| 32 bool AllowsExplicitCredentials() const; | |
| 33 | |
| 34 HttpAuth::AuthorizationResult ParseChallenge( | |
| 35 net::HttpAuthChallengeTokenizer* tok); | |
| 36 | |
| 37 // Generates an authentication token. | |
| 38 // The return value is an error code. If it's not |OK|, the value of | |
| 39 // |*auth_token| is unspecified. | |
| 40 // The function may return |IO_PENDING|, and call |callback| on completion. | |
| 41 // |auth_token| must remain valid until the callback has been called. | |
| 42 // |spn| is the Service Principal Name of the server that the token is | |
| 43 // being generated for. | |
| 44 // If this is the first round of a multiple round scheme, credentials are | |
| 45 // obtained using |*credentials|. If |credentials| is NULL, the default | |
| 46 // credentials are used instead. | |
| 47 int GenerateAuthToken(const AuthCredentials* credentials, | |
| 48 const std::string& spn, | |
| 49 std::string* auth_token, | |
| 50 const net::CompletionCallback& callback); | |
| 51 | |
| 52 // Delegation is allowed on the Kerberos ticket. This allows certain servers | |
| 53 // to act as the user, such as an IIS server retrieiving data from a | |
|
Bernhard Bauer
2015/05/18 15:11:53
Nit: "retrieving"
aberent
2015/05/18 17:07:30
Fixed here, and in the Windows and Posix versions
| |
| 54 // Kerberized MSSQL server. | |
| 55 void Delegate(); | |
| 56 void SetResult(JNIEnv* env, jobject obj, bool result, jstring token); | |
| 57 static bool Register(JNIEnv* env); | |
| 58 | |
| 59 private: | |
| 60 std::string account_type_; | |
| 61 std::string scheme_; | |
| 62 bool can_delegate_; | |
| 63 bool first_challenge_; | |
| 64 std::string server_auth_token_; | |
| 65 std::string* auth_token_; | |
| 66 base::android::ScopedJavaGlobalRef<jobject> java_authenticator_; | |
| 67 net::CompletionCallback completion_callback_; | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(AndroidAuthNegotiate); | |
| 70 }; | |
| 71 | |
| 72 } // namespace android | |
| 73 } // namespace net | |
| 74 | |
| 75 #endif // NET_HTTP_HTTP_ANDROID_AUTH_NEGOTIATE_H_ | |
| OLD | NEW |