From d5b285df95c654980ed3af2a5b6178600ad59f2f Mon Sep 17 00:00:00 2001
From: Cheng-Yu Chung <chengyuc@google.com>
Date: Mon, 21 Nov 2022 23:06:10 -0500
Subject: [PATCH] Remove `include/grpcpp/impl/codegen/create_auth_context.h`
 (#31359)

* Remove `include/grpcpp/impl/codegen/create_auth_context.h`

* Update

* Automated change: Fix sanity tests
---
 BUILD                                         |  1 +
 CMakeLists.txt                                |  2 ++
 build_autogenerated.yaml                      |  2 ++
 gRPC-C++.podspec                              |  1 +
 include/grpcpp/client_context.h               |  2 +-
 .../grpcpp/impl/codegen/create_auth_context.h | 12 ++-----
 include/grpcpp/impl/create_auth_context.h     | 34 +++++++++++++++++++
 tools/doxygen/Doxyfile.c++                    |  1 +
 tools/doxygen/Doxyfile.c++.internal           |  1 +
 9 files changed, 45 insertions(+), 11 deletions(-)
 create mode 100644 include/grpcpp/impl/create_auth_context.h

diff --git a/BUILD b/BUILD
index d2f56cd4ecd04..e5083fb874d2d 100644
--- a/BUILD
+++ b/BUILD
@@ -342,6 +342,7 @@ GRPCXX_PUBLIC_HDRS = [
     "include/grpcpp/impl/client_unary_call.h",
     "include/grpcpp/impl/codegen/core_codegen.h",
     "include/grpcpp/impl/completion_queue_tag.h",
+    "include/grpcpp/impl/create_auth_context.h",
     "include/grpcpp/impl/delegating_channel.h",
     "include/grpcpp/impl/grpc_library.h",
     "include/grpcpp/impl/intercepted_channel.h",
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea97f9b6c0627..b904e0569bfcd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3446,6 +3446,7 @@ foreach(_hdr
   include/grpcpp/impl/codegen/sync_stream.h
   include/grpcpp/impl/codegen/time.h
   include/grpcpp/impl/completion_queue_tag.h
+  include/grpcpp/impl/create_auth_context.h
   include/grpcpp/impl/delegating_channel.h
   include/grpcpp/impl/grpc_library.h
   include/grpcpp/impl/intercepted_channel.h
@@ -4138,6 +4139,7 @@ foreach(_hdr
   include/grpcpp/impl/codegen/sync_stream.h
   include/grpcpp/impl/codegen/time.h
   include/grpcpp/impl/completion_queue_tag.h
+  include/grpcpp/impl/create_auth_context.h
   include/grpcpp/impl/delegating_channel.h
   include/grpcpp/impl/grpc_library.h
   include/grpcpp/impl/intercepted_channel.h
diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml
index b56c1ed7962e3..bbadba3b2e8cc 100644
--- a/build_autogenerated.yaml
+++ b/build_autogenerated.yaml
@@ -2821,6 +2821,7 @@ libs:
   - include/grpcpp/impl/codegen/sync_stream.h
   - include/grpcpp/impl/codegen/time.h
   - include/grpcpp/impl/completion_queue_tag.h
+  - include/grpcpp/impl/create_auth_context.h
   - include/grpcpp/impl/delegating_channel.h
   - include/grpcpp/impl/grpc_library.h
   - include/grpcpp/impl/intercepted_channel.h
@@ -3244,6 +3245,7 @@ libs:
   - include/grpcpp/impl/codegen/sync_stream.h
   - include/grpcpp/impl/codegen/time.h
   - include/grpcpp/impl/completion_queue_tag.h
+  - include/grpcpp/impl/create_auth_context.h
   - include/grpcpp/impl/delegating_channel.h
   - include/grpcpp/impl/grpc_library.h
   - include/grpcpp/impl/intercepted_channel.h
diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec
index 8cc2d97d6f3f8..f5593353367c8 100644
--- a/gRPC-C++.podspec
+++ b/gRPC-C++.podspec
@@ -147,6 +147,7 @@ Pod::Spec.new do |s|
                       'include/grpcpp/impl/codegen/sync_stream.h',
                       'include/grpcpp/impl/codegen/time.h',
                       'include/grpcpp/impl/completion_queue_tag.h',
+                      'include/grpcpp/impl/create_auth_context.h',
                       'include/grpcpp/impl/delegating_channel.h',
                       'include/grpcpp/impl/grpc_library.h',
                       'include/grpcpp/impl/intercepted_channel.h',
diff --git a/include/grpcpp/client_context.h b/include/grpcpp/client_context.h
index 4caecb7d800b6..12161aba543c9 100644
--- a/include/grpcpp/client_context.h
+++ b/include/grpcpp/client_context.h
@@ -41,8 +41,8 @@
 #include <grpc/impl/codegen/compression_types.h>
 #include <grpc/impl/codegen/propagation_bits.h>
 #include <grpcpp/impl/codegen/core_codegen_interface.h>
-#include <grpcpp/impl/codegen/create_auth_context.h>
 #include <grpcpp/impl/codegen/sync.h>
+#include <grpcpp/impl/create_auth_context.h>
 #include <grpcpp/impl/metadata_map.h>
 #include <grpcpp/impl/rpc_method.h>
 #include <grpcpp/security/auth_context.h>
diff --git a/include/grpcpp/impl/codegen/create_auth_context.h b/include/grpcpp/impl/codegen/create_auth_context.h
index 817988f3aa22e..b3a10428f303e 100644
--- a/include/grpcpp/impl/codegen/create_auth_context.h
+++ b/include/grpcpp/impl/codegen/create_auth_context.h
@@ -21,15 +21,7 @@
 
 // IWYU pragma: private
 
-#include <memory>
-
-#include <grpc/impl/codegen/grpc_types.h>
-#include <grpcpp/impl/codegen/security/auth_context.h>
-
-namespace grpc {
-
-std::shared_ptr<const AuthContext> CreateAuthContext(grpc_call* call);
-
-}  // namespace grpc
+/// TODO(chengyuc): Remove this file after solving compatibility.
+#include <grpcpp/impl/create_auth_context.h>
 
 #endif  // GRPCPP_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H
diff --git a/include/grpcpp/impl/create_auth_context.h b/include/grpcpp/impl/create_auth_context.h
new file mode 100644
index 0000000000000..e6c8c2ae76ff3
--- /dev/null
+++ b/include/grpcpp/impl/create_auth_context.h
@@ -0,0 +1,34 @@
+/*
+ *
+ * Copyright 2015 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef GRPCPP_IMPL_CREATE_AUTH_CONTEXT_H
+#define GRPCPP_IMPL_CREATE_AUTH_CONTEXT_H
+
+#include <memory>
+
+#include <grpc/impl/codegen/grpc_types.h>
+#include <grpcpp/security/auth_context.h>
+
+namespace grpc {
+
+/// TODO(ctiller): not sure we want to make this a permanent thing
+std::shared_ptr<const AuthContext> CreateAuthContext(grpc_call* call);
+
+}  // namespace grpc
+
+#endif  // GRPCPP_IMPL_CREATE_AUTH_CONTEXT_H
diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++
index 045a6fa6ad553..3609a72fc68e1 100644
--- a/tools/doxygen/Doxyfile.c++
+++ b/tools/doxygen/Doxyfile.c++
@@ -1011,6 +1011,7 @@ include/grpcpp/impl/codegen/sync.h \
 include/grpcpp/impl/codegen/sync_stream.h \
 include/grpcpp/impl/codegen/time.h \
 include/grpcpp/impl/completion_queue_tag.h \
+include/grpcpp/impl/create_auth_context.h \
 include/grpcpp/impl/delegating_channel.h \
 include/grpcpp/impl/grpc_library.h \
 include/grpcpp/impl/intercepted_channel.h \
diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal
index c132ac30c068d..0ec213d2dabb0 100644
--- a/tools/doxygen/Doxyfile.c++.internal
+++ b/tools/doxygen/Doxyfile.c++.internal
@@ -1011,6 +1011,7 @@ include/grpcpp/impl/codegen/sync.h \
 include/grpcpp/impl/codegen/sync_stream.h \
 include/grpcpp/impl/codegen/time.h \
 include/grpcpp/impl/completion_queue_tag.h \
+include/grpcpp/impl/create_auth_context.h \
 include/grpcpp/impl/delegating_channel.h \
 include/grpcpp/impl/grpc_library.h \
 include/grpcpp/impl/intercepted_channel.h \