Ai
1 Star 0 Fork 0

hardstylewyl/GRPC_Samples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
InterServices.cs 582 Bytes
一键复制 编辑 原始数据 按行查看 历史
hardstylewyl 提交于 2025-01-06 20:42 +08:00 . update:补充提交
using Common;
using Google.Protobuf.WellKnownTypes;
using Grpc.Core;
using Microsoft.AspNetCore.Authorization;
using User;
namespace GrpcServer_Demo.Services;
public class InterServices : inter.InternalService.InternalServiceBase
{
//[Authorize(Roles = GlobalConst.AdminPolicy)]
[Authorize(Policy = GlobalConst.AdminPolicy)]
public override Task<SafeCallResponse> InternalCall(Empty request, ServerCallContext context)
{
return Task.FromResult(new SafeCallResponse() { HeaderValue = context.RequestHeaders.Get("caller-user")?.Value ?? "null" });
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hardstylewyl/grpc_samples.git
git@gitee.com:hardstylewyl/grpc_samples.git
hardstylewyl
grpc_samples
GRPC_Samples
master

搜索帮助