随笔分类 - 8-C# Asp.Net Core
摘要:OAuth 2.0 规定了四种获得令牌的流程 1 authorization_code — 授权码模式(即先登录获取code,再获取token) 2 password — 密码模式(将用户名,密码传过去,直接获取token) 3 client_credentials — 客户端模式(无用户,用户向客
阅读全文
摘要:一、浏览器缓存 服务器如果返回 cache-control:max-age=60,则表示服务器通知浏览器端可以缓存这个内容60秒 //缓存3秒 [ResponseCache(Duration = 3)] [HttpGet] public DateTime get() { return DateTim
阅读全文
摘要:服务端 public class Startup { public void ConfigureServices(IServiceCollection services) { //services.AddAuthentication(CertificateAuthenticationDefaults
阅读全文
摘要:让服务器配置为可以接受客户端证书的方法 Microsoft.AspNetCore.Authentication.Certificate services.AddAuthentication(CertificateAuthenticationDefaults.AuthenticationScheme)
阅读全文
摘要:定义消息类型 //使用proto3版本,如果不写,默认使用proto2 syntax = "proto3"; option csharp_namespace = "GrpcServer.Protos"; message SearchRequest { /* 每一个字段对应一个数值 数值1-15需要一
阅读全文
摘要:一、快速安装apollo 微服务配置中心 https://github.com/apolloconfig/apollo-build-scripts 下载 1.安装 jdk1.8+ 2.安装mysql 5.6.5+ 执行sql创建两个数据库 3.修改apollo配置连接 4.运行 使用bash打开(安
阅读全文
摘要:IdentityServer是基于OpenID Connect协议标准的身份认证和授权程序,它实现了OpenID Connect 和 OAuth 2.0 协议 PS记录下 如何为项目添加解决方案,暂时放这。 OpenID Connect 身份认证协议 OAuth 2.0 协议 客户端授权模式 这个是
阅读全文
摘要:服务注册与发现,服务健康检查 https://www.consul.io/downloads 下载 就一个consul.exe文件。 1.安装 三种角色 -dev consul agent -dev -client=0.0.0.0 -client=0.0.0.0代理谁可以访问,目前的意思是任意客户端
阅读全文
摘要:网关 水平扩展、垂直拆分 安装ocelot 1 nuget引入ocelot 2 创建一个空项目 3.Startup.cs 导入 using Ocelot.DependencyInjection; using Ocelot.Middleware; 添加中间件 public class Startup
阅读全文
摘要:地址为允许的客户端地址,ps客户端需要起一个server services.AddCors(option => option.AddPolicy("cors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials()
阅读全文
摘要:var providedApiKey = Request.Headers[ApiKeyHeaderName].ToString();
阅读全文