Coder Social home page Coder Social logo

kasugaharu / identityservice.sample.dotnetcore Goto Github PK

View Code? Open in Web Editor NEW

This project forked from coder-edisonzhou/identityservice.sample.dotnetcore

0.0 1.0 0.0 8.31 MB

一个基于IdentityServer4和Ocelot的统一验证与授权ASP.NET Core微服务示例程序项目

C# 80.40% HTML 17.12% CSS 2.30% JavaScript 0.18%

identityservice.sample.dotnetcore's Introduction

IdentityService.Sample.DotNetCore

关于IdentityServer


IdentityServer4(这里只使用版本号为4)是一个基于OpenID Connect和OAuth 2.0的针对ASP.NET Core 2.0的框架。IdentityServer是将规范兼容的OpenID Connect和OAuth 2.0终结点添加到任意ASP.NET Core应用程序的中间件。通常,你构建(或重新使用)包含登录和注销页面的应用程序,IdentityServer中间件会向其添加必要的协议头,以便客户端应用程序可以使用这些标准协议与其对话。

我们可以用IdentityServer来做啥?

  • 身份验证服务=>官方认证的OpenID Connect实现
  • 单点登录/注销(SSO)
  • 访问受控的API=>为不同的客户提供访问API的令牌,比如:MVC网站、SPA、Mobile App等
  • 等等等......

IdentityServer4 github : https://github.com/IdentityServer/IdentityServer4

关于Ocelot


Ocelot是一个使用.NET Core平台上的一个API Gateway,这个项目的目标是在.NET上面运行微服务架构。Ocelot框架内部集成了IdentityServer(身份验证)和Consul(服务注册发现),还引入了Polly来处理进行故障处理。目前,腾讯和微软是Ocelot在官网贴出来的客户。
Ocelot github : https://github.com/TomPallister/Ocelot

关于此示例项目


这里,假设我们有两个客户端(一个Web网站,一个移动App),他们要使用系统,需要通过API网关(这里API网关始终作为客户端的统一入口)先向IdentityService进行Login以进行验证并获取Token,在IdentityService的验证过程中会访问数据库以验证。然后再带上Token通过API网关去访问具体的API Service。这里我们的IdentityService基于IdentityServer4开发,它具有统一登录验证和授权的功能。

必要中间件的安装:
Ocelot

PM> Install-Package Ocelot

IdentityServer

PM> Install-Package IdentityServer4

参考博文

此系列相关参考:
基于IdentityServer实现授权与验证服务(Part 1)
基于IdentityServer实现授权与验证服务(Part 2)
基于Ocelot+IdentityServer实现统一验证与授权服务
更多.Net Core相关文章:
.NET Core微服务基础学习与实践系列文章目录导航

identityservice.sample.dotnetcore's People

Contributors

coder-edisonzhou avatar kasugaharu avatar wswind avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.