1 #region Copyright notice and license
3 // Copyright 2015 gRPC authors.
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
20 using System.Collections.Generic;
21 using System.Threading.Tasks;
23 using Grpc.Core.Internal;
24 using Grpc.Core.Utils;
29 /// Asynchronous authentication interceptor for <see cref="CallCredentials"/>.
31 /// <param name="context">The interceptor context.</param>
32 /// <param name="metadata">Metadata to populate with entries that will be added to outgoing call's headers.</param>
33 /// <returns></returns>
34 public delegate Task AsyncAuthInterceptor(AuthInterceptorContext context, Metadata metadata);
37 /// Context for an RPC being intercepted by <see cref="AsyncAuthInterceptor"/>.
39 public class AuthInterceptorContext
41 readonly string serviceUrl;
42 readonly string methodName;
45 /// Initializes a new instance of <c>AuthInterceptorContext</c>.
47 public AuthInterceptorContext(string serviceUrl, string methodName)
49 this.serviceUrl = GrpcPreconditions.CheckNotNull(serviceUrl);
50 this.methodName = GrpcPreconditions.CheckNotNull(methodName);
54 /// The fully qualified service URL for the RPC being called.
56 public string ServiceUrl
58 get { return serviceUrl; }
62 /// The method name of the RPC being called.
64 public string MethodName
66 get { return methodName; }