|
|
@ -61,7 +61,7 @@ namespace Grpc.Auth |
|
|
|
return new AsyncAuthInterceptor((context, metadata) => |
|
|
|
return new AsyncAuthInterceptor((context, metadata) => |
|
|
|
{ |
|
|
|
{ |
|
|
|
metadata.Add(CreateBearerTokenHeader(accessToken)); |
|
|
|
metadata.Add(CreateBearerTokenHeader(accessToken)); |
|
|
|
return TaskUtils.CompletedTask; |
|
|
|
return GetCompletedTask(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -69,5 +69,17 @@ namespace Grpc.Auth |
|
|
|
{ |
|
|
|
{ |
|
|
|
return new Metadata.Entry(AuthorizationHeader, Schema + " " + accessToken); |
|
|
|
return new Metadata.Entry(AuthorizationHeader, Schema + " " + accessToken); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Framework independent equivalent of <c>Task.CompletedTask</c>. |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
private static Task GetCompletedTask() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#if NETSTANDARD1_5 || NETSTANDARD2_0 |
|
|
|
|
|
|
|
return Task.CompletedTask; |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
return Task.FromResult<object>(null); // for .NET45, emulate the functionality |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|