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

Side by Side 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, 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
1 #region Copyright notice and license 1 #region Copyright notice and license
2 // Protocol Buffers - Google's data interchange format 2
3 // Copyright 2008 Google Inc. All rights reserved. 3 // Copyright 2015-2016, Google Inc.
4 // https://developers.google.com/protocol-buffers/ 4 // All rights reserved.
5 // 5 //
6 // Redistribution and use in source and binary forms, with or without 6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are 7 // modification, are permitted provided that the following conditions are
8 // met: 8 // met:
9 // 9 //
10 // * Redistributions of source code must retain the above copyright 10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer. 11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above 12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following disclaimer 13 // copyright notice, this list of conditions and the following disclaimer
14 // in the documentation and/or other materials provided with the 14 // in the documentation and/or other materials provided with the
15 // distribution. 15 // distribution.
16 // * Neither the name of Google Inc. nor the names of its 16 // * Neither the name of Google Inc. nor the names of its
17 // contributors may be used to endorse or promote products derived from 17 // contributors may be used to endorse or promote products derived from
18 // this software without specific prior written permission. 18 // this software without specific prior written permission.
19 // 19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
31 #endregion 32 #endregion
32 33
33 namespace Google.Protobuf.Reflection 34 using System;
35 using System.Collections.Generic;
36 using System.Threading.Tasks;
37
38 using Grpc.Core.Internal;
39 using Grpc.Core.Utils;
40
41 namespace Grpc.Core
34 { 42 {
35 /// <summary> 43 /// <summary>
36 /// Descriptor for a single enum value within an enum in a .proto file. 44 /// Asynchronous authentication interceptor for <see cref="CallCredentials"/ >.
37 /// </summary> 45 /// </summary>
38 public sealed class EnumValueDescriptor : DescriptorBase 46 /// <param name="context">The interceptor context.</param>
47 /// <param name="metadata">Metadata to populate with entries that will be ad ded to outgoing call's headers.</param>
48 /// <returns></returns>
49 public delegate Task AsyncAuthInterceptor(AuthInterceptorContext context, Me tadata metadata);
50
51 /// <summary>
52 /// Context for an RPC being intercepted by <see cref="AsyncAuthInterceptor" />.
53 /// </summary>
54 public class AuthInterceptorContext
39 { 55 {
40 private readonly EnumDescriptor enumDescriptor; 56 readonly string serviceUrl;
41 private readonly EnumValueDescriptorProto proto; 57 readonly string methodName;
42 58
43 internal EnumValueDescriptor(EnumValueDescriptorProto proto, FileDescrip tor file, 59 /// <summary>
44 EnumDescriptor parent, int index) 60 /// Initializes a new instance of <c>AuthInterceptorContext</c>.
45 : base(file, parent.FullName + "." + proto.Name, index) 61 /// </summary>
62 public AuthInterceptorContext(string serviceUrl, string methodName)
46 { 63 {
47 this.proto = proto; 64 this.serviceUrl = GrpcPreconditions.CheckNotNull(serviceUrl);
48 enumDescriptor = parent; 65 this.methodName = GrpcPreconditions.CheckNotNull(methodName);
49 file.DescriptorPool.AddSymbol(this);
50 file.DescriptorPool.AddEnumValueByNumber(this);
51 } 66 }
52 67
53 internal EnumValueDescriptorProto Proto { get { return proto; } } 68 /// <summary>
69 /// The fully qualified service URL for the RPC being called.
70 /// </summary>
71 public string ServiceUrl
72 {
73 get { return serviceUrl; }
74 }
54 75
55 /// <summary> 76 /// <summary>
56 /// Returns the name of the enum value described by this object. 77 /// The method name of the RPC being called.
57 /// </summary> 78 /// </summary>
58 public override string Name { get { return proto.Name; } } 79 public string MethodName
59 80 {
60 /// <summary> 81 get { return methodName; }
61 /// Returns the number associated with this enum value. 82 }
62 /// </summary>
63 public int Number { get { return Proto.Number; } }
64
65 /// <summary>
66 /// Returns the enum descriptor that this value is part of.
67 /// </summary>
68 public EnumDescriptor EnumDescriptor { get { return enumDescriptor; } }
69 } 83 }
70 } 84 }
OLDNEW
« 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