日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > asp.net >内容正文

asp.net

ASP.NET Core分布式项目实战(业务介绍,架构设计,oAuth2,IdentityServer4)--学习笔记...

發(fā)布時(shí)間:2023/12/4 asp.net 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ASP.NET Core分布式项目实战(业务介绍,架构设计,oAuth2,IdentityServer4)--学习笔记... 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

任務(wù)4:第一章計(jì)劃與目錄

  • 敏捷產(chǎn)品開(kāi)發(fā)流程

  • 原型預(yù)覽與業(yè)務(wù)介紹

  • 整體架構(gòu)設(shè)計(jì)

  • API 接口設(shè)計(jì) / swagger

  • Identity Server 4 搭建登錄

  • 賬號(hào) API 實(shí)現(xiàn)

  • 配置中心

任務(wù)5:業(yè)務(wù)介紹

項(xiàng)目背景:基于人脈關(guān)系的金融行業(yè)項(xiàng)目

用戶:

1、賬號(hào):

  • 基本資料維護(hù)

  • 登錄

2、管理自己的項(xiàng)目

  • 創(chuàng)建

  • 分享(可見(jiàn)權(quán)限范圍)

  • 置頂

  • 查看項(xiàng)目進(jìn)展

3、引入別人的項(xiàng)目

  • 查看好友的項(xiàng)目

  • 查看二度人脈的項(xiàng)目

  • 查看系統(tǒng)推薦的項(xiàng)目

  • 查看別人的項(xiàng)目

  • 參與別人的項(xiàng)目

4、消息:

  • 聊天消息

  • 系統(tǒng)消息

5、好友:

  • 添加好友(導(dǎo)入通信錄,手機(jī)號(hào)搜索好友)

任務(wù)6:架構(gòu)設(shè)計(jì)

任務(wù)7:oAuth2介紹

OAuth是一個(gè)關(guān)于授權(quán)(authorization)的開(kāi)放網(wǎng)絡(luò)標(biāo)準(zhǔn)

四種授權(quán)方式:

  • 授權(quán)碼模式

  • 簡(jiǎn)化模式

  • 密碼模式

  • 客戶端模式

理解OAuth 2.0:

https://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html

任務(wù)8:IdentityServer4登錄中心

新建項(xiàng)目

dotnet new webapi --name IdentityServerCenter

添加 Nuget 包:IdentityServer4

VS Code 如何安裝 nuget:

https://blog.csdn.net/qq_36051316/article/details/84106418

安裝失敗原因及解決方案:

vscode解決nuget插件不能使用的問(wèn)題:

https://www.cnblogs.com/lori/p/11651079.html

Visual Studio 連接不上NuGet 官方程序包源的解決辦法:

https://blog.csdn.net/weixin_34161083/article/details/85764761

配置 Startup 配置

添加引用

using IdentityServer4;

注冊(cè)服務(wù)

services.AddIdentityServer().AddDeveloperSigningCredential();

使用服務(wù)

app.UseIdentityServer();

在 Program.cs 中配置啟動(dòng)端口

webBuilder.UseUrls("http://localhost:5000");

添加配置類 Config.cs,初始化 IdentityServer4

using System.Collections; using System.Collections.Generic; using IdentityServer4.Models;namespace IdentityServerCenter {public class Config{public static IEnumerable<ApiResource> GetResource(){return new List<ApiResource>{new ApiResource("api", "My Api")};}public static IEnumerable<Client> GetClients(){return new List<Client>{new Client(){ClientId = "client",AllowedGrantTypes = GrantTypes.ClientCredentials,ClientSecrets ={new Secret("secret".Sha256())},AllowedScopes = {"api"},}};}} }

更改 IdentityServer4 配置

services.AddIdentityServer().AddDeveloperSigningCredential().AddInMemoryApiResources(Config.GetResource()).AddInMemoryClients(Config.GetClients());

啟動(dòng)程序

dotnet run

訪問(wèn)地址

http://localhost:5000/.well-known/openid-configuration

結(jié)果如下( json 格式化)

{"issuer": "http://localhost:5000","jwks_uri": "http://localhost:5000/.well-known/openid-configuration/jwks","authorization_endpoint": "http://localhost:5000/connect/authorize","token_endpoint": "http://localhost:5000/connect/token","userinfo_endpoint": "http://localhost:5000/connect/userinfo","end_session_endpoint": "http://localhost:5000/connect/endsession","check_session_iframe": "http://localhost:5000/connect/checksession","revocation_endpoint": "http://localhost:5000/connect/revocation","introspection_endpoint": "http://localhost:5000/connect/introspect","device_authorization_endpoint": "http://localhost:5000/connect/deviceauthorization","frontchannel_logout_supported": true,"frontchannel_logout_session_supported": true,"backchannel_logout_supported": true,"backchannel_logout_session_supported": true,"scopes_supported": ["api","offline_access"],"claims_supported": [],"grant_types_supported": ["authorization_code","client_credentials","refresh_token","implicit","urn:ietf:params:oauth:grant-type:device_code"],"response_types_supported": ["code","token","id_token","id_token token","code id_token","code token","code id_token token"],"response_modes_supported": ["form_post","query","fragment"],"token_endpoint_auth_methods_supported": ["client_secret_basic","client_secret_post"],"id_token_signing_alg_values_supported": ["RS256"],"subject_types_supported": ["public"],"code_challenge_methods_supported": ["plain","S256"],"request_parameter_supported": true }

可以看到四種授權(quán)方式:

"grant_types_supported": ["authorization_code","client_credentials","refresh_token","implicit","urn:ietf:params:oauth:grant-type:device_code"],

課程鏈接

http://video.jessetalk.cn/course/explore

相關(guān)文章

ASP.NET Core分布式項(xiàng)目實(shí)戰(zhàn)(課程介紹,MVP,瀑布與敏捷)--學(xué)習(xí)筆記

ASP.NET Core快速入門(mén) -- 學(xué)習(xí)筆記匯總

總結(jié)

以上是生活随笔為你收集整理的ASP.NET Core分布式项目实战(业务介绍,架构设计,oAuth2,IdentityServer4)--学习笔记...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。