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.

  • 相关阅读:
    开始我的博客园
    科技生态链
    程式建议
    如何自动识别判断url中的中文参数是GB2312还是Utf-8编码?
    jquery.cookie 使用方法
    数据结构(Java)——查找和排序(5)
    数据结构(Java)——查找和排序(4)
    数据结构(Java)——查找和排序(3)
    数据结构(Java)——查找和排序(2)
    数据结构(Java)——查找和排序(1)
  • 原文地址:https://www.cnblogs.com/pengzhen/p/7084942.html
Copyright © 2011-2022 走看看