OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_ANDROID_HTTP_AUTH_NEGOTIATE_ANDROID_H_ | 5 #ifndef NET_ANDROID_HTTP_AUTH_NEGOTIATE_ANDROID_H_ |
6 #define NET_ANDROID_HTTP_AUTH_NEGOTIATE_ANDROID_H_ | 6 #define NET_ANDROID_HTTP_AUTH_NEGOTIATE_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 bool Init(); | 68 bool Init(); |
69 | 69 |
70 // True if authentication needs the identity of the user from Chrome. | 70 // True if authentication needs the identity of the user from Chrome. |
71 bool NeedsIdentity() const; | 71 bool NeedsIdentity() const; |
72 | 72 |
73 // True authentication can use explicit credentials included in the URL. | 73 // True authentication can use explicit credentials included in the URL. |
74 bool AllowsExplicitCredentials() const; | 74 bool AllowsExplicitCredentials() const; |
75 | 75 |
76 // Parse a received Negotiate challenge. | 76 // Parse a received Negotiate challenge. |
77 HttpAuth::AuthorizationResult ParseChallenge( | 77 HttpAuth::AuthorizationResult ParseChallenge( |
78 net::HttpAuthChallengeTokenizer* tok); | 78 const HttpAuthChallengeTokenizer& tok); |
79 | 79 |
80 // Generates an authentication token. | 80 // Generates an authentication token. |
81 // | 81 // |
82 // The return value is an error code. The authentication token will be | 82 // The return value is an error code. The authentication token will be |
83 // returned in |*auth_token|. If the result code is not |OK|, the value of | 83 // returned in |*auth_token|. If the result code is not |OK|, the value of |
84 // |*auth_token| is unspecified. | 84 // |*auth_token| is unspecified. |
85 // | 85 // |
86 // If the operation cannot be completed synchronously, |ERR_IO_PENDING| will | 86 // If the operation cannot be completed synchronously, |ERR_IO_PENDING| will |
87 // be returned and the real result code will be passed to the completion | 87 // be returned and the real result code will be passed to the completion |
88 // callback. Otherwise the result code is returned immediately from this | 88 // callback. Otherwise the result code is returned immediately from this |
89 // call. | 89 // call. |
90 // | 90 // |
91 // If the AndroidAuthNegotiate object is deleted before completion then the | 91 // If the AndroidAuthNegotiate object is deleted before completion then the |
92 // callback will not be called. | 92 // callback will not be called. |
93 // | 93 // |
94 // If no immediate result is returned then |auth_token| must remain valid | 94 // If no immediate result is returned then |auth_token| must remain valid |
95 // until the callback has been called. | 95 // until the callback has been called. |
96 // | 96 // |
97 // |spn| is the Service Principal Name of the server that the token is | 97 // |spn| is the Service Principal Name of the server that the token is |
98 // being generated for. | 98 // being generated for. |
99 // | 99 // |
100 // If this is the first round of a multiple round scheme, credentials are | 100 // If this is the first round of a multiple round scheme, credentials are |
101 // obtained using |*credentials|. If |credentials| is NULL, the default | 101 // obtained using |*credentials|. If |credentials| is NULL, the default |
102 // credentials are used instead. | 102 // credentials are used instead. |
103 int GenerateAuthToken(const AuthCredentials* credentials, | 103 int GenerateAuthToken(const AuthCredentials* credentials, |
104 const std::string& spn, | 104 const std::string& spn, |
105 std::string* auth_token, | 105 std::string* auth_token, |
106 const net::CompletionCallback& callback); | 106 const CompletionCallback& callback); |
107 | 107 |
108 // Delegation is allowed on the Kerberos ticket. This allows certain servers | 108 // Delegation is allowed on the Kerberos ticket. This allows certain servers |
109 // to act as the user, such as an IIS server retrieving data from a | 109 // to act as the user, such as an IIS server retrieving data from a |
110 // Kerberized MSSQL server. | 110 // Kerberized MSSQL server. |
111 void Delegate(); | 111 void Delegate(); |
112 | 112 |
113 private: | 113 private: |
114 void SetResultInternal(int result, const std::string& token); | 114 void SetResultInternal(int result, const std::string& token); |
115 | 115 |
116 std::string account_type_; | 116 std::string account_type_; |
117 bool can_delegate_; | 117 bool can_delegate_; |
118 bool first_challenge_; | 118 bool first_challenge_; |
119 std::string server_auth_token_; | 119 std::string server_auth_token_; |
120 std::string* auth_token_; | 120 std::string* auth_token_; |
121 base::android::ScopedJavaGlobalRef<jobject> java_authenticator_; | 121 base::android::ScopedJavaGlobalRef<jobject> java_authenticator_; |
122 net::CompletionCallback completion_callback_; | 122 net::CompletionCallback completion_callback_; |
123 | 123 |
124 base::WeakPtrFactory<HttpAuthNegotiateAndroid> weak_factory_; | 124 base::WeakPtrFactory<HttpAuthNegotiateAndroid> weak_factory_; |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(HttpAuthNegotiateAndroid); | 126 DISALLOW_COPY_AND_ASSIGN(HttpAuthNegotiateAndroid); |
127 }; | 127 }; |
128 | 128 |
129 } // namespace android | 129 } // namespace android |
130 } // namespace net | 130 } // namespace net |
131 | 131 |
132 #endif // NET_ANDROID_HTTP_AUTH_NEGOTIATE_ANDROID_H_ | 132 #endif // NET_ANDROID_HTTP_AUTH_NEGOTIATE_ANDROID_H_ |
OLD | NEW |