IdentityServer4:Endpoint

Endpoint的概念在IdentityServer里其实就是一些资源操作的url地址;如同Restful API里面的Endpoint是概念;

那么可以通过你自己的授权服务端得到相对应的地址与信息:

标准地址:http://授权服务端地址/.well-known/openid-configuration

1、Discovery Endpoin

就是展示IdentityServer相关元数据、发行者名称(Issuer)、该授权服务器能够授权的所有scope;地址就是上面那个标准地址

当然实际操作环境中可以使用代码查看和操作;我们可以通过官方提供的IdentityModel封装的类库;

比如前面:通过IdentityModel封装的DiscoverClient对象;向授权服务器获取DiscoveryResponse对象;其根本原理还是发起原始的HTTP请求;

客户端包帮我们把地址和标准的http帮我们封装了;直接拿基地址就可以操作;

            DiscoveryClient dc = new DiscoveryClient("http://localhost:5000");
            DiscoveryResponse disco = await dc.GetAsync();
            //DiscoveryResponse disco2 = await DiscoveryClient.GetAsync("http://localhost:5000");

            // request token
            var tokenClient = new TokenClient(disco.TokenEndpoint, "client", "secret");
            var tokenResponse = await tokenClient.RequestClientCredentialsAsync("api1");

2、Authorize Endpoint

用户通过浏览器请求token或者授权码使用这个url;Authorize Endpoint内部包括用户身份认证、用户允许授权

3、Token Endpoint

文档:

https://identityserver4.readthedocs.io/en/release/endpoints/userinfo.html

原文地址:https://www.cnblogs.com/xmai/p/7454645.html