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 | |
Bernhard Bauer
2015/06/01 14:51:13
Remove empty line?
aberent
2015/06/10 15:48:56
Done.
| |
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. | |
Bernhard Bauer
2015/05/15 15:06:16
Do we want to mention that the callback will not e
aberent
2015/05/18 13:45:28
Other similar examples typically don't. I would te
Bernhard Bauer
2015/05/18 15:11:53
Not in this particular case, but it's good to be a
aberent
2015/05/18 17:07:30
Done.
Bernhard Bauer
2015/06/01 14:51:13
You could add a DCHECK(completion_callback_.is_nul
aberent
2015/06/10 15:48:56
Done, together with a couple of other checks.
| |
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 | |
54 // Kerberized MSSQL server. | |
55 void Delegate(); | |
56 void SetResult(JNIEnv* env, jobject obj, bool result, jstring token); | |
57 | |
58 private: | |
59 std::string account_type_; | |
60 std::string scheme_; | |
61 bool can_delegate_; | |
62 bool first_challenge_; | |
63 std::string server_auth_token_; | |
64 std::string* auth_token_; | |
65 base::android::ScopedJavaGlobalRef<jobject> java_authenticator_; | |
66 net::CompletionCallback completion_callback_; | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(AndroidAuthNegotiate); | |
69 }; | |
70 | |
71 bool RegisterHttpNegotiateAuthenticator(JNIEnv* env); | |
72 | |
73 } // namespace android | |
74 } // namespace net | |
75 | |
76 #endif // NET_HTTP_HTTP_ANDROID_AUTH_NEGOTIATE_H_ | |
OLD | NEW |