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

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

Issue 1128043007: Support Kerberos on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix more nits from bauerb@ Created 5 years, 7 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_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 //
39 // The return value is an error code. The authentication token will be
40 // returned in |*auth_token|. If the result code not |OK|, the value of
41 // |*auth_token| is unspecified.
42 //
43 // If the operation cannot be completed synchronously, |ERR_IO_PENDING| will
44 // be returned and the real result code will be passed to the completion
45 // callback. Otherwise the result code is returned immediately from this
46 // call.
47 //
48 // If the AndroidAuthNegotiate object is deleted before completion then the
49 // callback will not be called.
50 //
51 // If no immediate result is returned then |auth_token| must remain valid
52 // until the callback has been called.
53 //
54 // |spn| is the Service Principal Name of the server that the token is
55 // being generated for.
56 //
57 // If this is the first round of a multiple round scheme, credentials are
58 // obtained using |*credentials|. If |credentials| is NULL, the default
59 // credentials are used instead.
60 int GenerateAuthToken(const AuthCredentials* credentials,
61 const std::string& spn,
62 std::string* auth_token,
63 const net::CompletionCallback& callback);
64
65 // Delegation is allowed on the Kerberos ticket. This allows certain servers
66 // to act as the user, such as an IIS server retrieving data from a
67 // Kerberized MSSQL server.
68 void Delegate();
69 void SetResult(JNIEnv* env, jobject obj, bool result, jstring token);
70 static bool Register(JNIEnv* env);
71
72 private:
73 std::string account_type_;
74 std::string scheme_;
75 bool can_delegate_;
76 bool first_challenge_;
77 std::string server_auth_token_;
78 std::string* auth_token_;
79 base::android::ScopedJavaGlobalRef<jobject> java_authenticator_;
80 net::CompletionCallback completion_callback_;
81
82 DISALLOW_COPY_AND_ASSIGN(AndroidAuthNegotiate);
83 };
84
85 } // namespace android
86 } // namespace net
87
88 #endif // NET_HTTP_HTTP_ANDROID_AUTH_NEGOTIATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698