Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: net/android/http_auth_negotiate_android.h

Issue 1128043007: Support Kerberos on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle review comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_ANDROID_HTTP_AUTH_NEGOTIATE_ANDROID_H_
6 #define NET_ANDROID_HTTP_AUTH_NEGOTIATE_ANDROID_H_
7
8 #include <jni.h>
9 #include <string>
10
11 #include "base/android/jni_android.h"
12 #include "base/callback.h"
13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/task_runner.h"
Ryan Sleevi 2015/06/16 01:07:46 You can forward declare this
aberent 2015/06/19 15:06:24 Done.
17 #include "net/base/completion_callback.h"
18 #include "net/http/http_auth.h"
19
20 namespace net {
21
22 class HttpAuthChallengeTokenizer;
23
24 namespace android {
25
26 class NET_EXPORT_PRIVATE HttpAuthNegotiateAndroid {
Ryan Sleevi 2015/06/16 01:07:46 Could you comment this class?
aberent 2015/06/19 15:06:24 Done.
27 public:
28 HttpAuthNegotiateAndroid(const std::string& account_type);
Ryan Sleevi 2015/06/16 01:07:46 Could you document this constructor?
aberent 2015/06/19 15:06:24 Done.
29 ~HttpAuthNegotiateAndroid();
30 bool Init();
Ryan Sleevi 2015/06/16 01:07:46 Could you add a newline between 29/30 And documen
aberent 2015/06/19 15:06:24 Done.
31
32 bool NeedsIdentity() const;
33
34 bool AllowsExplicitCredentials() const;
35
36 // Generates an authentication token.
37 //
38 // The return value is an error code. The authentication token will be
39 // returned in |*auth_token|. If the result code not |OK|, the value of
40 // |*auth_token| is unspecified.
41 //
42 // If the operation cannot be completed synchronously, |ERR_IO_PENDING| will
43 // be returned and the real result code will be passed to the completion
44 // callback. Otherwise the result code is returned immediately from this
45 // call.
46 //
47 // If the AndroidAuthNegotiate object is deleted before completion then the
48 // callback will not be called.
49 //
50 // If no immediate result is returned then |auth_token| must remain valid
51 // until the callback has been called.
52 //
53 // |spn| is the Service Principal Name of the server that the token is
54 // being generated for.
55 //
56 // If this is the first round of a multiple round scheme, credentials are
57 // obtained using |*credentials|. If |credentials| is NULL, the default
58 // credentials are used instead.
59 int GenerateAuthToken(const AuthCredentials* credentials,
60 const std::string& spn,
61 std::string* auth_token,
62 const net::CompletionCallback& callback);
63
64 // Delegation is allowed on the Kerberos ticket. This allows certain servers
65 // to act as the user, such as an IIS server retrieving data from a
66 // Kerberized MSSQL server.
67 void Delegate();
Ryan Sleevi 2015/06/16 01:07:46 The naming of this is weird, especially when this
aberent 2015/06/19 15:06:24 The naming of the members of this class has to mat
68 void SetResult(JNIEnv* env, jobject obj, bool result, jstring token);
69 static bool Register(JNIEnv* env);
Ryan Sleevi 2015/06/16 01:07:46 Most of the code in Android I've seen makes this t
aberent 2015/06/19 15:06:24 Done.
70 void SetServerAuthToken(const std::string& encoded_auth_token,
71 const std::string& decoded_auth_token) {
72 server_auth_token_ = encoded_auth_token;
73 }
74
75 private:
76 void SetResultInternal(bool result, const std::string& token);
77
78 std::string account_type_;
79 std::string scheme_;
80 bool can_delegate_;
81 bool first_challenge_;
82 std::string server_auth_token_;
83 std::string* auth_token_;
84 base::android::ScopedJavaGlobalRef<jobject> java_authenticator_;
85 net::CompletionCallback completion_callback_;
86 scoped_refptr<base::TaskRunner> callback_task_runner_;
87 base::Callback<void(bool, const std::string&)> thread_safe_callback_;
88
89 base::WeakPtrFactory<HttpAuthNegotiateAndroid> weak_factory_;
90
91 DISALLOW_COPY_AND_ASSIGN(HttpAuthNegotiateAndroid);
92 };
93
94 } // namespace android
95 } // namespace net
96
97 #endif // NET_ANDROID_HTTP_AUTH_NEGOTIATE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698