Tips:本篇已加入,.Net core 3.1 使用IdentityServer4 實作 OAuth2.0 --閱讀目錄 可點擊查看更多相關文章,
前言
本來這篇隨筆,開始寫之前我大概羅列了一下,準備還是先帶大家了解一下IdentityServer的一些概念,順便解釋一下之后實戰篇會提及的一些名詞,我重新翻了一遍官方檔案后正好說到 startup,我覺得 .net core Startup中,
Authentication 和 Authorization 有必要說一下,這兩個看似差不多的單詞,確實一開始我自己也傻傻分不清楚到底是干嘛的,那么現在言歸正傳,開始今天的隨筆,
IdentityServer4介紹
學習一個技術最好的檔案就是官方檔案 https://identityserver4.readthedocs.io/en/3.1.0/ 如果英語閱讀能力有限,可以網路上搜一下有沒有大牛的中文翻譯+案例演示,最終大家還是要嘗試閱讀官方檔案,有能力的甚至可以看一下原始碼(這一點我自己也在努力中),
那么從這篇文章開始說到做到,我們看一下 英文的介紹:
|
IdentityServer4 is an OpenID Connect and OAuth 2.0 framework for ASP.NET Core. It enables the following features in your applications: Authentication as a Service Centralized login logic and workflow for all of your applications (web, native, mobile, services). IdentityServer is an officially certified implementation of OpenID Connect. Single Sign-on / Sign-out Single sign-on (and out) over multiple application types. Access Control for APIs Issue access tokens for APIs for various types of clients, e.g. server to server, web applications, SPAs and native/mobile apps. Federation Gateway Support for external identity providers like Azure Active Directory, Google, Facebook etc. This shields your applications from the details of how to connect to these external providers. Focus on Customization The most important part - many aspects of IdentityServer can be customized to fit your needs. Since IdentityServer is a framework and not a boxed product or a SaaS, you can write code to adapt the system the way it makes sense for your scenarios. Mature Open Source IdentityServer uses the permissive Apache 2 license that allows building commercial products on top of it. It is also part of the .NET Foundation which provides governance and legal backing. Free and Commercial Support If you need help building or running your identity platform, let us know. There are several ways we can help you out. |
意思就是告訴大家 IdentityServer4 是一個 同時實作了OpenID Connect and OAuth 2.0(什么是OAuth2.0 這里我開一個傳送門 可以看之前的博客) 的.netcore 框架 ,
注意看7個加粗的標題:作為服務進行身份驗證 , 單點登錄注銷SSO , API資源的訪問控制 ,對外部平臺的支持 ,專注于定制 , 成熟的開源,免費和商業支持
意思就是ID4 已經很成熟的一個身份認證框架,支持Azure,谷歌,facebook等平臺,可以在框架里定制一些功能,并且開源免費也可以在源代碼層面進行修改,
這樣我們可以省去很多時間去構造一個符合標準流程的授權服務,并且我們相信一個成熟的開源專案在代碼執行效率上也是大家公認的,
檔案目錄如下


INTRODUCTION 介紹 (理論概念)
QUICKSTARTS 快速開始(大部分檔案都是有一個快速的可運行的demo案例)
TOPICS 話題 (比較著重的可以分類出來的點)
ENDPOINTS (這個我不知道怎么翻譯,就和我們常說的到這個服務端endpoint,startup中配置路由的endpoint差不多的概念)
REFERENCE 參考(一些名詞的解釋,就像我們看書的時候 下面的注釋)
MISC 其他
我分享一下我的學習方式:
1.基礎概念肯定先看,我們至少要知道這個能做什么.
2.然后一開始可能接觸原版檔案對我來說會比較難,我也會網路上看一些國內的翻譯一些demo,這個時候我已經大致能知道怎么用了
3.哪塊東西不明白我才會針對性的在官網里搜索關鍵詞,或者是哪一塊我覺得demo里可能還有一些屬性沒說清楚我再看看檔案
4.結合專案實戰 :那當然有時候我會做一些技術儲備,更多的是我碰到了什么問題需要在專案中用到,畢竟實踐出真知
(強調:不是真實開發中都要用到最新的技術,適合場景的才是最好的,不要盲目一味的堆用新技術)
5.最最后,我會整理一下 x-mind ,在公司內做一些技術分享,這會很有用,因為你要授課,你就必須至少自己理清楚(也感謝騰訊直播,讓我在公司內部做了一把直播)
名詞解釋
之后的實戰中我可能會提及一些名詞,這里我先解釋一下,或者告訴一下大家 哪些東西我縮寫,簡稱成什么:
ID4 :之后IdentityServer4 我都會簡稱成 ID4
未完待續,明天繼續把剩余的部分補完.......
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/60901.html
標籤:.NET Core
