zoukankan      html  css  js  c++  java
  • .net core 中 Identity Server 4 Topic 之 Startup

    约定 简称 Id4。

    Id4在.net core 中的使用符合.net core 的约定架构,即Services来注册服务,middleware方式集成。

    1. 配置服务

    通过DI注入:

    public void ConfigureServices(IServiceCollection services)
    {
        var builder = services.AddIdentityServer();
    }
    

    也可以使用选项模式,配置更多的参数。

                services.AddIdentityServer((ops) =>
                {
                    ops.Endpoints.EnableDiscoveryEndpoint = true
                })
    

    1. 2 Key material

    • AddSigningCredential
      添加签名证书服务提供token的创建/验证。
    • AddTemporarySigningCredential
      创建临时签名证书服务。用于DEV环境下没有证书可用的时候。
    • AddDeveloperSigningCredential
    • AddValidationKeys
      Adds keys for validating tokens. They will be used by the internal token validator and will show up in the discovery document. This is useful for key roll-over scenarios.

    1. 3 In-Memory configuration stores

    内存数据库,存储等。

    • AddInMemoryClients
      注册内存环境的Client。
    • AddInMemoryIdentityResources
      注册内存环境的IdentityResource 。
    • AddInMemoryApiResources
      定义内存环境中的Api资源。

    1. 4 Test Stores

    用于非生产环境下的开发。默认的quickstart UI下。

    • AddTestUsers

    1. 5 额外的服务

    • AddExtensionGrantValidator
    • AddSecretParser
    • AddSecretValidator
    • AddResourceOwnerValidator
    • AddProfileService
    • AddAuthorizeInteractionResponseGenerator
    • AddCustomAuthorizeRequestValidator
    • AddCustomTokenRequestValidator

    1.6 缓存

    • AddClientStoreCache
    • AddResourceStoreCache

    实现了 ICache接口。

    2. 配置管道

    public void Configure(IApplicationBuilder app)
    {
        app.UseIdentityServer();
    }
    
    

    中间件的方式集成Id4.

  • 相关阅读:
    搜刮一些开源项目的APP
    iOS Crash文件的解析
    iOS中RGB颜色转换
    随笔杂记
    iOS字体
    方法总结
    经验点滴
    个人理解
    OC 知识点回顾
    IOS UI 笔记整理回顾
  • 原文地址:https://www.cnblogs.com/pengzhen/p/7084942.html
Copyright © 2011-2022 走看看