Chromium Code Reviews| Index: net/android/http_android_auth_negotiate.h |
| diff --git a/net/android/http_android_auth_negotiate.h b/net/android/http_android_auth_negotiate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..421ff75fcfa37baced527fe16a8a39e7b68a1c6b |
| --- /dev/null |
| +++ b/net/android/http_android_auth_negotiate.h |
| @@ -0,0 +1,74 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NET_HTTP_HTTP_ANDROID_AUTH_NEGOTIATE_H_ |
| +#define NET_HTTP_HTTP_ANDROID_AUTH_NEGOTIATE_H_ |
| + |
| +#include <jni.h> |
| +#include <string> |
| + |
| +#include "base/android/jni_android.h" |
| +#include "base/macros.h" |
| + |
| +#include "net/base/completion_callback.h" |
| +#include "net/http/http_auth.h" |
| + |
| +namespace net { |
| + |
| +class HttpAuthChallengeTokenizer; |
| + |
| +namespace android { |
| + |
| +class NET_EXPORT_PRIVATE AndroidAuthNegotiate { |
| + public: |
| + AndroidAuthNegotiate(const std::string& account_type, |
| + const std::string& scheme); |
| + ~AndroidAuthNegotiate(); |
| + bool Init(); |
| + |
| + bool NeedsIdentity() const; |
| + |
| + bool AllowsExplicitCredentials() const; |
| + |
| + HttpAuth::AuthorizationResult ParseChallenge( |
| + net::HttpAuthChallengeTokenizer* tok); |
| + |
| + // Generates an authentication token. |
| + // The return value is an error code. If it's not |OK|, the value of |
| + // |*auth_token| is unspecified. |
| + // |spn| is the Service Principal Name of the server that the token is |
| + // being generated for. |
| + // If this is the first round of a multiple round scheme, credentials are |
| + // obtained using |*credentials|. If |credentials| is NULL, the default |
| + // credentials are used instead. |
| + int GenerateAuthToken(const AuthCredentials* credentials, |
| + const std::string& spn, |
| + std::string* auth_token, |
| + const net::CompletionCallback& callback); |
| + |
| + // Delegation is allowed on the Kerberos ticket. This allows certain servers |
| + // to act as the user, such as an IIS server retrieiving data from a |
| + // Kerberized MSSQL server. |
| + void Delegate(); |
| + void SetResult(JNIEnv* env, jobject obj, bool result, jstring token); |
| + |
| + private: |
| + std::string account_type_; |
| + std::string scheme_; |
| + bool can_delegate_; |
| + bool first_challenge_; |
| + std::string server_auth_token_; |
| + std::string* auth_token_; |
| + base::android::ScopedJavaGlobalRef<jobject> java_authenticator_; |
| + net::CompletionCallback completion_callback_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AndroidAuthNegotiate); |
| +}; |
| + |
| +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.
|
| + |
| +} // namespace android |
| +} // namespace net |
| + |
| +#endif // NET_HTTP_HTTP_ANDROID_AUTH_NEGOTIATE_H_ |