NetCore项目实战篇05---添加Ocelot网关并集成identity server4认证
今天来给我们的项目增加API网关,使用Ocelot。 它是系统暴露在外部的一个访问入口,这个有点像代理访问的家伙,就像一个公司的门卫承担着寻址、限制进入、安全检查、位置引导、等等功能。同时我们还要在网关中集成了Identity Server(Identity Server在项目中的使用见上一篇文章),当网关需要请求认证信息的时候会与Identity Server服务器进行交互来完成。多说也无益,直接上项目吧。
新建一个空的.netcore项目,命名为Zhengwei.Gateway新建好后引入Ocelot包,我们之前项目中已有Zhengwei.Identity和Zhengwei.Use.Api,项目结构图如下:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQMAAAEgCAYAAACw6RZTAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAADRSSURBVHhe7Z0LdFXlmff/UFEQqoAWq0tOuHqJvSigfuvzJDWpY2bseFpTnbHNahpljLV+1sSp9QJEhODQzpomWhUN1abhi+2MndiJraupGiw59muF8dJ2gpWLnKSjoxUBBZEK+L3Ps993n733Ofvccs4hO+f5sTY5+359/+/zvHvv/x5XWVn9IRyMG3cU3n77Td3nZvr0Gfx37949/NfFvGpcMfVFPLrpbT1ADbroalTPoV870N/Rj608NM70RbW4fMFua5yav3HWDnQ8PxVXXH42pm1/Bh1PbbcmNOMc/c510XI+i2d0/3QsuuJs7H5Ur2/6Al7erv6H8ZQ1QI3/AhbscizfDMOL+MmjzyO+Bxpa/zm7k4/j5U/FC/3AOVN3Y9eCWdj9kx44DoMbvT3Tdu3AdszCnGk00HN89P7+ZPfZuHy2+qvWO/2iWkx9Xi1XbeUVnwWefnQH5lxxofph1jUHF10xFc8n20bFPDP/23pf1Xq328ckDh3LBbt7PMPj8xh4XqjtrJ6lhyh2xY8fnftZOzzLp/1yTu84x9a1MFUvg/btC5j6gnN+tX+Ns7Aj4TrynG+DOS9meu81NIr56le/wp3hhz9cx12mTJlyvP6VOVTm8yIG5kTuev6neGHqF7QAKPTJjouCQp3s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RAEASmoA2I9F6C2J4JwuimKA2IYntWZFI9gjzaCfK2jxEKKgZiezZa8BE2KoB59xCgB6vG4jEc+xQ0TaCCJbZnowGffSExaAWW5vNRaF5mJRCKyZOFAaFozxnQi0pie1Y6lNfQG5ZL0BkNo1qCg0BRlLsJJAhie2Zwzqen06F6cW3PEilv7rGXucm1HL999XImaiqsNyzJLCXc4ExBrPShPeJelr1/I9x2YeQURQwoIhDbMxpO840G27Mk8DGIqRTJLNf5MlWG64s0os68jsyeCMbJKE64pQr9Zh38GrUIwGih4GJAQiC2Z9bPRLuxI2R7lozB7RhSS27xNjRmsb64YBG96I/OZCcjJ640rLcD3UOSTowWCi4GYnuWBQWzPVPLGZqJsnm61zCvzH57kg1NeFkqWmmlQu8QhYzWRz6GSiTqurRoWG8lhuoapeYPCAUVA7E985DObqxgtmfGZcjTDqBKq12Tq+mbeaSKVmrJyViLR6r1OdfBEUTUkWZQt1INcdf8YUePEWIxQh0dFFQMxPbMi3e+4tmeDbbVYkWU0gAzn8dUZbAd26rNOJUKDK3UPgOZrY9SBCSYmlKq4BaAKKrs5XRxG0WWQiwUjED5GYjtWZChuwnyebXRSCD9DCbteRNbmi/EuOkncz8JATH+1NOw5R8vwsH/2Y4bb2ziwu/sRg9UIFKE6oJwBBHbs2JDeXZJ2p5JZDBaEdszQRAYsT0TBMGFiIEgCIyIgSAIjIiBIAiMiIEgCIyIgSAIjIiBIAiMiIEgCIyIgSAIjIiBIAiMiIEgCIyIgSAIjIiBIAiMiIEgCIyIgSAIjIiBIAiMiIEgCIyIgSAIjIiBIAiMiIEgCIyIgSAIjIiBIAiMiIEgCIyIgSAIjIiBIAiMiIEgCIyIgSAIjIiBIAiMiIEgCArg/wOY6Dpdk9z9MgAAAABJRU5ErkJggg==" alt="">
在上图中我们看到一个Ocelot.json文件,里面设置了所有对当前这个网关的配置。它会接收所有的客户端请求,并路由到对应的下游服务器进行处理,再将请求结果返回。而这个上下游请求的对应关系也被称之为路由。配置如下:
{
"GlobalConfiguration": {
"BaseUrl": "http://localhost"
},
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/users",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": ""
}
],
"UpstreamPathTemplate": "/users",
"UpstreamHttpMethod": [ "Get" ],
"AuthenticationOptions": {
"AuthenticationProviderKey": "zhengwei",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/connect/token",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": ""
}
],
"UpstreamPathTemplate": "/connect/token",
"UpstreamHttpMethod": [ "Post" ] } ] }
其中,DownstreamPathTemplate是下游服务。DownstreamScheme是下游服务http schema。DownstreamHostAndPorts是下游服务的地址,如果使用LoadBalancer的话这里可以填多项。UpstreamPathTemplate: 上游也就是用户输入的请求Url模板。UpstreamHttpMethod: 上游请求http方法,可使用数组
从配置文件中我们可以看出本来通过http://localhost:33545/api/users访问的use api现在可以通过http://localhost: 4157/api/users来访问,本来通过http://localhost: 1110/connect/token来访问的现在可以通过http://localhost: 4157/connect/token来访问,http://localhost: 4157是网关项目的地址。
3、在项目启动时来引入我们的配置文件Ocelot.json吧,写在Program.cs文件中,代码如下:
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
} public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((webhost,builder)=>{
builder.SetBasePath(webhost.HostingEnvironment.ContentRootPath)
.AddJsonFile("Ocelot.json");
})
.UseStartup<Startup>()
.UseUrls("http://+:80")
.Build();
}
4、 在Startup.cs文件中加入我们的认证服务吧,注意这里的authenticationProviderKey=“zhengwei”,要与我们Ocelot.json文件中的"AuthenticationProviderKey": "zhengwei"一致,代码如下:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
} public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
var authenticationProviderKey = "zhengwei"; services.AddAuthentication()
.AddIdentityServerAuthentication(authenticationProviderKey, options=> {
options.Authority = "http://localhost:1110/";
options.ApiName = "gateway_api";
options.SupportedTokens = SupportedTokens.Both;
options.ApiSecret = "secret";
options.RequireHttpsMetadata = false;
});
services.AddOcelot();
} // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
} app.UseOcelot();
}
}
5、一切就序,那我们就开始测试吧,右键解决方案---》属性-->多个项目启动----》操作中将三个项目都设置为启动,关闭后点击启动,启动好后,打开postman,输入网址http://localhost:4157/users
可惜,给我们返回的验证吗是401未认证,然来是我们没有提交对应的token.那就先获取token值吧。输入网址:http://localhost:4157/connect/token,得到如下的返回值,其中access_token就是我们要的token值,复制下来吧。
6、复制下我们的token后,再次请求http://localhost:4157/users前要加入参数,在Headers中输入key: Authorization 输入对应的值:bearer + 复制过来的access_token,再次请求,会获取到useapi接口正常返回的值了。如下图
至此,我们的ocelot和Identity Server在我们的项目中集成完毕。
NetCore项目实战篇05---添加Ocelot网关并集成identity server4认证的更多相关文章
- NetCore项目实战篇06---服务注册与发现之consul
至此,我们的解决方案中新建了三个项目,网关(Zhengwei.Gateway).认证中心(Zhengwei.Identity)和用户资源API(Zhengwei.Use.Api).当要访问用户API的 ...
- NetCore项目实战篇08---Docker挂载mysql并连接.netCoreWeb
我们的项目之前在直接连接的mysql,今天我们将通过docker挂载mysql 并与我们开发的webapi项目连接. 1. 安装docker 下载地址: https://download.docker ...
- NetCore项目实战篇04---集成IdentityService4
大家都知道我们的项目中已有web api,现在可以正式访问,不论任何人只要通过输入对应的api网址就可以访问到我们的api 资源,这样是很不安全的,我们需求对当前用户进行身份验证,因此我们在项目中使用 ...
- NetCore项目实战篇02---全局异常处理
在 .netcore中可以自定义自己的异常类型,步骤如下: 1.自定义自己的异常类型UserOperationException 并继承自Exception public class UserOper ...
- NetCore项目实战篇03---HTTP Patch 更新数据
一.什么是HTPP Patch HTTP1.0定义了三种请求方法: GET, POST 和 HEAD方法. HTTP1.1新增了五种请求方法:OPTIONS, PUT, DELETE, TRACE 和 ...
- NetCore项目实战篇07---服务保护之polly
1. 为什么要用polly 前面的项目中,一个服务调用另一个(Zhengwei.Identity调用Zhengwei.Use.Api)服务时是直接调用的,在这个调用的过程中可能会发生各种瞬态故障,这 ...
- 洗礼灵魂,修炼python(82)--全栈项目实战篇(10)—— 信用卡+商城项目(模拟京东淘宝)
本次项目相当于对python基础做总结,常用语法,数组类型,函数,文本操作等等 本项目在博客园里其他开发者也做过,我是稍作修改来的,大体没变的 项目需求: 信用卡+商城: A.信用卡(类似白条/花呗) ...
- C# Xamarin移动开发项目实战篇
一.课程介绍 在前面阿笨的<C# Xamarin移动开发基础进修篇>课程中,大家已经熟悉和了解了Xamarin移动App开发的基础知识和原理.本次分享课<C# Xamarin移动开发 ...
- 洗礼灵魂,修炼python(73)--全栈项目实战篇(1)——【转载】前提准备之学习ubuntu
本篇是为项目实战做准备,学习Linux是必备的,不然都不好意思叫全栈对吧?下面是一位资深大神写的文章,够详细,我也不用浪费时间再写了 原文链接:Ubuntu学习——第一篇 内容: 一. Ubuntu简 ...
随机推荐
- [模板]SPFA判负环
目录 一.BFS法判负环 二.DFS法判负环 三.SPFA判正环 一.BFS法判负环 Code: #include<bits/stdc++.h> #define re register # ...
- ASE课程总结 by 冯晓云
开始的开始,采访往届ASE班的blog:http://www.cnblogs.com/legs/p/4894362.html 和北航软工M1检查:http://www.cnblogs.com/legs ...
- vue中的错误日志
一.Error compiling template: Component template requires a root element, rather than just text. 这个错误意 ...
- Navicat自动备份数据库
@ 目录 Navicat自动备份数据库 备份与还原 修改备份位置 MySQL:5.7 Navicat:11 Windows10 重要数据库的定时备份是非常重要的,使用Navicat可以非常方便快捷地自 ...
- linux 文件的查找和压缩
1.使用 locate 命令 需要安装:yum install mlocate -y 创建或更新 slocate/locate 命令所必需的数据库文件:updatedb 作用:搜索不经常改变的文件如配 ...
- vue3开发饿了么商城2020年新版本
带手机验证码登陆, 带全套购物车系统 带数据库 前后端分离开发 带定位用户功能 数据库代码为本地制作好了 带支付宝支付系统 带django开发服务器接口教程 地址: https://www.dua ...
- java 脚本引擎执行js
为用到时,使用方便直接保存一下代码 package com.xzlf.reflectTest; import java.io.BufferedReader; import java.io.FileIn ...
- 详解PHP中instanceof关键字及instanceof关键字有什么作用
来源:https://www.jb51.net/article/74409.htm PHP5的另一个新成员是instdnceof关键字.使用这个关键字可以确定一个对象是类的实例.类的子类,还是实现了某 ...
- bootstrop设置背景图片自适应屏幕
如果不用bootstrop框架,想让背景图片自适应窗口大小,可以这样做: <style type="text/css"> html{height: %;} body.a ...
- (五)PL/SQL条件控制
简述 决策结构需要程序员指定一个或多个条件要计算,或由程序进行测试,如果条件被确定为真那么一条或多条语句被执行,如果要被执行的其它语句条件被确定为假,则选其它执行块. PL/SQL编程语言提供了以下几 ...