随笔分类 -  dotnet core

摘要:Ref:http://www.dannysite.com/blog/176/ OAuth2.0协议定义了用于获得授权的四种主要授权类型。 1. Client Credentials 一种基于APP的密钥直接进行授权,因此APP的权限非常大。它适合像数据库或存储服务器这种对API的访问需求。 示例: 阅读全文
posted @ 2017-06-28 17:57 _DN 阅读(416) 评论(0) 推荐(0)
摘要:客户端指能够从id4获取Token的角色。 客户端的共性: a unique client ID a secret if needed the allowed interactions with the token service (called a grant type) a network lo 阅读全文
posted @ 2017-06-27 19:40 _DN 阅读(359) 评论(0) 推荐(0)
摘要:想要让客户端能够访问API资源,就需要在Identity Server中定义好API的资源。 Scope作用域:即API资源的访问范围限制。 作用域是一个资源 (通常也称为 Web API) 的标识符。 阅读全文
posted @ 2017-06-27 19:33 _DN 阅读(279) 评论(0) 推荐(0)
摘要:Steps: 1.新建一个ASP.NET Core Web项目,SigmalHex.IdentityServer; 2.安装包 3.Startup中加入 AddIdentityServer 注册Identity Server 服务到DI系统。 AddTemporarySigningCredentia 阅读全文
posted @ 2017-06-27 16:31 _DN 阅读(633) 评论(1) 推荐(0)
摘要:id4的职责: 保护你的资源 通过本地 账户库(Account Store)或者外部身份提供其 认证用户 提供Session管理以及SSO 管理和认证客户端 发行身份及访问Token给客户端 验证Token 1. User用户 使用客户端访问资源的人(Human)。 2. Client客户端 指需要 阅读全文
posted @ 2017-06-27 14:56 _DN 阅读(262) 评论(0) 推荐(0)
摘要:约定 简称 Id4。 Id4在.net core 中的使用符合.net core 的约定架构,即Services来注册服务,middleware方式集成。 1. 配置服务 通过DI注入: 也可以使用选项模式,配置更多的参数。 1. 2 Key material AddSigningCredentia 阅读全文
posted @ 2017-06-27 14:22 _DN 阅读(462) 评论(0) 推荐(0)
摘要:JWT符合[RFC 7519]规范,它的优势在于能够取代Session和Cookie验证的方式。属于Token Based的范畴。 1. JWT的三段組成解析 注:三个部分之间用英文句号.来分隔。 1.2 _header_ 编码后: 一般Header只需要这两个字段即可。 1.2_payload(关 阅读全文
posted @ 2017-06-05 13:32 _DN 阅读(245) 评论(0) 推荐(0)
摘要:前提: 特點: 1. 使用nstancePerLifetimeScope代替InstancePerRequest. 2. 不再需要DependencyResolver 一切都交給tartup.ConfigureServices返回的IServiceProvider去完成,在控制器内,如果需要Serv 阅读全文
posted @ 2017-05-27 14:53 _DN 阅读(272) 评论(0) 推荐(0)
摘要:1. Install 2.Startup 2.1 增加成員 2.2 Startup.ConfigureServices 返回值改為:IServiceProvider 末尾中增加: 3. Usage 3.1 构造注入 直接構造注入即可使用。 3.2 使用ServiceProvider获取。 Ref:官 阅读全文
posted @ 2017-05-27 14:41 _DN 阅读(556) 评论(0) 推荐(0)
摘要:1.Install 2. conifg 創建文件:log4net.config 對應Startup中的配置: 3.Startup 4.Usage 使用經典的LogManager獲取日誌對象: 阅读全文
posted @ 2017-05-27 13:31 _DN 阅读(429) 评论(0) 推荐(0)
摘要:1. configservice 先讀取支持的配置地址; 配置默認策略,制定Urls內全部支持 2. Configure 啟用中間件 3. 所有Action支持 ref:http://www.cnblogs.com/xingbo/p/6093325.html 阅读全文
posted @ 2017-05-26 19:24 _DN 阅读(227) 评论(0) 推荐(0)
摘要:Install Package Swashbuckle Pre 1.Startup 如上: // swagger start // swagger end 2.launchSettings.json 如: "launchUrl": "swagger/ui/index", 阅读全文
posted @ 2017-05-26 18:03 _DN 阅读(359) 评论(0) 推荐(0)
摘要:• Application Startup 應用程序啟動 • Middleware 中間件 • Working with Static Files 靜態文件 • Routing 路由 • URL Rewriting Middleware URL重定向中間件 • Error Handling 錯誤處理 阅读全文
posted @ 2017-05-25 18:21 _DN 阅读(222) 评论(0) 推荐(0)
摘要:``` FROM microsoft/dotnet:1.0.0-preview2-sdk RUN mkdir /app WORKDIR /app COPY project.json /app RUN ["dotnet", "restore"] COPY . /app RUN ["dotnet", "build"] EXPOSE 5000/tcp CMD ["dotnet", "run"] `... 阅读全文
posted @ 2016-10-27 12:36 _DN 阅读(142) 评论(0) 推荐(0)
摘要:Install EF 创建模型 创建Blog,Post模型 DI 创建数据库 创建一个Controller,View 按照模块创建即可测试。 Ref:https://docs.efproject.net/en/latest/platforms/aspnetcore/new db.html 阅读全文
posted @ 2016-08-11 10:47 _DN 阅读(326) 评论(0) 推荐(0)
摘要:中间件简介 ASP.NET Core 由很多中间件构成,实现了一个HTTP请求管道(pipeline)。 Request的Response的管道可以看成一个Push Stack 和 Pop Stack。 在Startup.cs的Configure方法中配置中间件。 实现一个中间件 1. 构造函数Re 阅读全文
posted @ 2016-08-10 15:48 _DN 阅读(138) 评论(0) 推荐(0)
摘要:静态资源包括HTML,CSS,图片和Js文件。在ASP.NET Core 1.0中,静态资源默认的所在目录是wwwroot,wwwroot可以在project.json中定义。 Steps: 1. 在wwwroot下面添加静态资源; 2. Startup的Config里面配置:app.UseStat 阅读全文
posted @ 2016-08-10 15:07 _DN 阅读(179) 评论(0) 推荐(0)
摘要:Transient – A new instance of the service is created each time it is requested. It can be used for stateless and light weight services. 可以理解为每次都要创建,主要 阅读全文
posted @ 2016-08-10 14:08 _DN 阅读(176) 评论(0) 推荐(0)
摘要:创建一个ASP.NET Core MVC项目的时候,会产生一个bower.json的文件,用于管理前段的js. NPM & Bower NPM主要运用于Node.js项目的内部依赖包管理,安装的模块位于项目根目录下的node_modules文件夹内 而Bower大部分情况下用于前端开发,对于CSS/ 阅读全文
posted @ 2016-08-10 11:40 _DN 阅读(326) 评论(0) 推荐(0)
摘要:Cross platform support and flexible runtime engine(跨平台支持和灵活的运行时引擎) ASP.NET Core 1.0 offers support for cross platform and this is seen to be an exciti 阅读全文
posted @ 2016-08-10 10:30 _DN 阅读(188) 评论(0) 推荐(0)