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 // |spn| is the Service Principal Name of the server that the token is | |
| 41 // being generated for. | |
| 42 // If this is the first round of a multiple round scheme, credentials are | |
| 43 // obtained using |*credentials|. If |credentials| is NULL, the default | |
| 44 // credentials are used instead. | |
| 45 int GenerateAuthToken(const AuthCredentials* credentials, | |
| 46 const std::string& spn, | |
| 47 std::string* auth_token, | |
| 48 const net::CompletionCallback& callback); | |
| 49 | |
| 50 // Delegation is allowed on the Kerberos ticket. This allows certain servers | |
| 51 // to act as the user, such as an IIS server retrieiving data from a | |
| 52 // Kerberized MSSQL server. | |
| 53 void Delegate(); | |
| 54 void SetResult(JNIEnv* env, jobject obj, bool result, jstring token); | |
| 55 | |
| 56 private: | |
| 57 std::string account_type_; | |
| 58 std::string scheme_; | |
| 59 bool can_delegate_; | |
| 60 bool first_challenge_; | |
| 61 std::string server_auth_token_; | |
| 62 std::string* auth_token_; | |
| 63 base::android::ScopedJavaGlobalRef<jobject> java_authenticator_; | |
| 64 net::CompletionCallback completion_callback_; | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(AndroidAuthNegotiate); | |
| 67 }; | |
| 68 | |
| 69 bool RegisterHttpNegotiateAuthenticator(JNIEnv* env); | |
|
Bernhard Bauer
2015/05/15 15:06:16
Move this into the class as a static method?
aberent
2015/05/18 13:45:27
Done.
| |
| 70 | |
| 71 } // namespace android | |
| 72 } // namespace net | |
| 73 | |
| 74 #endif // NET_HTTP_HTTP_ANDROID_AUTH_NEGOTIATE_H_ | |
| OLD | NEW |