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.

  • 相关阅读:
    zoj 3279 线段树 OR 树状数组
    fzu 1962 树状数组 OR 线段树
    hdu 5057 块状链表
    hdu3487 Play with Chain
    bzoj 1588营业额统计(HNOI 2002)
    poj2823 Sliding Window
    poj2828 Buy Tickets
    poj2395 Out of Hay
    poj3667 Hotel
    poj1703 Lost Cows
  • 原文地址:https://www.cnblogs.com/pengzhen/p/7084942.html
Copyright © 2011-2022 走看看