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

Unified Diff: third_party/grpc/src/csharp/Grpc.Core/AsyncAuthInterceptor.cs

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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: third_party/grpc/src/csharp/Grpc.Core/AsyncAuthInterceptor.cs
diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs b/third_party/grpc/src/csharp/Grpc.Core/AsyncAuthInterceptor.cs
similarity index 54%
copy from third_party/protobuf/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs
copy to third_party/grpc/src/csharp/Grpc.Core/AsyncAuthInterceptor.cs
index b212ce961854ae40666196cbcc78b0ff2fcb0173..5ba06d6509741551f5c25f18cbd7be06c98e28a3 100644
--- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs
+++ b/third_party/grpc/src/csharp/Grpc.Core/AsyncAuthInterceptor.cs
@@ -1,7 +1,7 @@
#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
+
+// Copyright 2015-2016, Google Inc.
+// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -28,43 +28,57 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
#endregion
-namespace Google.Protobuf.Reflection
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+using Grpc.Core.Internal;
+using Grpc.Core.Utils;
+
+namespace Grpc.Core
{
/// <summary>
- /// Descriptor for a single enum value within an enum in a .proto file.
+ /// Asynchronous authentication interceptor for <see cref="CallCredentials"/>.
/// </summary>
- public sealed class EnumValueDescriptor : DescriptorBase
- {
- private readonly EnumDescriptor enumDescriptor;
- private readonly EnumValueDescriptorProto proto;
+ /// <param name="context">The interceptor context.</param>
+ /// <param name="metadata">Metadata to populate with entries that will be added to outgoing call's headers.</param>
+ /// <returns></returns>
+ public delegate Task AsyncAuthInterceptor(AuthInterceptorContext context, Metadata metadata);
- internal EnumValueDescriptor(EnumValueDescriptorProto proto, FileDescriptor file,
- EnumDescriptor parent, int index)
- : base(file, parent.FullName + "." + proto.Name, index)
- {
- this.proto = proto;
- enumDescriptor = parent;
- file.DescriptorPool.AddSymbol(this);
- file.DescriptorPool.AddEnumValueByNumber(this);
- }
-
- internal EnumValueDescriptorProto Proto { get { return proto; } }
+ /// <summary>
+ /// Context for an RPC being intercepted by <see cref="AsyncAuthInterceptor"/>.
+ /// </summary>
+ public class AuthInterceptorContext
+ {
+ readonly string serviceUrl;
+ readonly string methodName;
/// <summary>
- /// Returns the name of the enum value described by this object.
+ /// Initializes a new instance of <c>AuthInterceptorContext</c>.
/// </summary>
- public override string Name { get { return proto.Name; } }
+ public AuthInterceptorContext(string serviceUrl, string methodName)
+ {
+ this.serviceUrl = GrpcPreconditions.CheckNotNull(serviceUrl);
+ this.methodName = GrpcPreconditions.CheckNotNull(methodName);
+ }
/// <summary>
- /// Returns the number associated with this enum value.
+ /// The fully qualified service URL for the RPC being called.
/// </summary>
- public int Number { get { return Proto.Number; } }
+ public string ServiceUrl
+ {
+ get { return serviceUrl; }
+ }
/// <summary>
- /// Returns the enum descriptor that this value is part of.
+ /// The method name of the RPC being called.
/// </summary>
- public EnumDescriptor EnumDescriptor { get { return enumDescriptor; } }
+ public string MethodName
+ {
+ get { return methodName; }
+ }
}
-}
+}
« no previous file with comments | « third_party/grpc/src/csharp/Grpc.Core/.gitignore ('k') | third_party/grpc/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698