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

Unified Diff: net/android/dummy_spnego_authenticator.h

Issue 1128043007: Support Kerberos on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android GN build 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 side-by-side diff with in-line comments
Download patch
Index: net/android/dummy_spnego_authenticator.h
diff --git a/net/android/dummy_spnego_authenticator.h b/net/android/dummy_spnego_authenticator.h
new file mode 100644
index 0000000000000000000000000000000000000000..89c101175450356a6ee6fe998446f0a7d694635d
--- /dev/null
+++ b/net/android/dummy_spnego_authenticator.h
@@ -0,0 +1,101 @@
+// Copyright (c) 2014 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_ANDROID_HTTP_DUMMY_SPNEGO_AUTHENTICATOR_H_
+#define NET_ANDROID_HTTP_DUMMY_SPNEGO_AUTHENTICATOR_H_
+
+#include <jni.h>
+#include <cstdint>
+#include <string>
+
+// Much of the code in this file is only here to duplicate the interfaces of
+// the Mock GSSAPI library, so that we can run the same tests on Android.
Ryan Sleevi 2015/06/29 13:56:44 https://groups.google.com/a/chromium.org/forum/#!t
aberent 2015/07/02 21:13:34 Done.
+
+namespace net {
+
+// These constant values are arbitrary, and different from the real GSSAPI
+// values, but must match those used in DummySpnegoAuthenticator.java
+#define GSS_S_COMPLETE 0
+#define GSS_S_CONTINUE_NEEDED 1
+#define GSS_S_FAILURE 2
+
+class gss_buffer_desc;
+
+typedef struct gss_OID_desc_struct {
+ uint32_t length;
+ void* elements;
+} gss_OID_desc, *gss_OID;
+
+extern gss_OID CHROME_GSS_SPNEGO_MECH_OID_DESC;
+
+namespace test {
+
+// Copy of class in Mock GSSAPI library.
+class GssContextMockImpl {
+ public:
+ GssContextMockImpl();
+ GssContextMockImpl(const GssContextMockImpl& other);
+ GssContextMockImpl(const char* src_name,
+ const char* targ_name,
+ uint32_t lifetime_rec,
+ const gss_OID_desc& mech_type,
+ uint32_t ctx_flags,
+ int locally_initiated,
+ int open);
+ ~GssContextMockImpl();
+
+ void Assign(const GssContextMockImpl& other);
+
+ std::string src_name;
+ std::string targ_name;
+ int32_t lifetime_rec;
+ gss_OID_desc mech_type;
+ int32_t ctx_flags;
+ int locally_initiated;
+ int open;
+};
+
+} // namespace test
+
+namespace android {
+
+// Interface to Java DummySpnegoAuthenticator.
+class DummySpnegoAuthenticator {
+ public:
+ struct SecurityContextQuery {
+ SecurityContextQuery(const std::string& expected_package,
+ uint32_t response_code,
+ uint32_t minor_response_code,
+ const test::GssContextMockImpl& context_info,
+ const char* expected_input_token,
+ const char* output_token);
+ ~SecurityContextQuery();
+
+ std::string expected_package;
+ uint32_t response_code;
+ uint32_t minor_response_code;
+ test::GssContextMockImpl context_info;
+ std::string expected_input_token;
+ std::string output_token;
+ };
+
+ static void EnsureTestAccountExists();
+ static void RemoveTestAccounts();
+
+ void ExpectSecurityContext(const std::string& expected_package,
+ uint32_t response_code,
+ uint32_t minor_response_code,
+ const test::GssContextMockImpl& context_info,
+ std::string& expected_input_token,
+ std::string& output_token);
+
+ static void SetNextResult(int result, const std::string& token);
+
+ static bool RegisterJni(JNIEnv* env);
+};
+
+} // namespace android
+} // namespace net
+
+#endif // NET_ANDROID_HTTP_DUMMY_SPNEGO_AUTHENTICATOR_DRIVER_H

Powered by Google App Engine
This is Rietveld 408576698