客户端定义(Defining Client)

客户端可以从你的IDS服务器请求tokens。

通常,客户端需要遵循下面的通用设置:

  • 一个唯一的Client ID

  • 如果需要还可以提供密码

  • 允许与token服务交互(授权类型)

  • identity 和/或 token被发送到的网络位置(redirect URI)

  • 客户端允许访问的scopes清单(resources)

Note:

在运行时,客户端通过实现IClientStore来检索。它允许在任意数据资源中加载比如配置文件或者数据库。此文档将使用内存版本进行客户端存储。你可以在ConfigureServices通过AddInMemoryClients额外方法连接内存存储。

定义一个服务器到服务器通信的客户端

在这种情况(scenario)下没有交互用户,服务端(这里是客户端)想和API(Scope)通信:


public class Clients
{
public static IEnumerable<Client> Get()
{
return new List<Client>
{
new Client
{
ClientId = "service.client",
ClientSecrets = { new Secret("secret".Sha256()) },

AllowedGrantTypes = GrantTypes.ClientCredentials,
AllowedScopes = { "api1", "api2.read_only" }
}
};
}
}

定义基于浏览器的JavaScript客户端(例如SPA)以进行用户认证和授权访问和API

var jsClient =new Client
{
ClientId="js",
ClientName=""
ClientName = "JavaScript Client",
ClientUri = "http://identityserver.io",

AllowedGrantTypes = GrantTypes.Implicit,
AllowAccessTokensViaBrowser = true,

RedirectUris = { "http://localhost:7017/index.html" },
PostLogoutRedirectUris = { "http://localhost:7017/index.html" },
AllowedCorsOrigins = { "http://localhost:7017" },

AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,

"api1", "api2.read_only"
}
}

定义服务器端Web应用程序(例如MVC)以进行使用验证和授权API访问

交互式服务器端(或本地桌面/移动)应用程序使用混合流。此流程为您提供最佳的安全性,因为访问令牌仅通过反向通道呼叫传输(并允许您访问刷新令牌)

var mvcClient = new Client
{
ClientId = "mvc",
ClientName = "MVC Client",
ClientUri = "http://identityserver.io",

AllowedGrantTypes = GrantTypes.Hybrid,
AllowOfflineAccess = true,
ClientSecrets = { new Secret("secret".Sha256()) },

RedirectUris = { "http://localhost:21402/signin-oidc" },
PostLogoutRedirectUris = { "http://localhost:21402/" },
FrontChannelLogoutUri = "http://localhost:21402/signout-oidc",

AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,

"api1", "api2.read_only"
},
};
												

IdentityServer4-客户端定义-翻译的更多相关文章

  1. IdentityServer4客户端如何获取自定义声明,了解一下?

    前言 久违了各位,之前录制过IdentityServer4的基础视频(https://space.bilibili.com/319652230/#/),有兴趣了解的童鞋可以看一下,只不过未发表成博客. ...

  2. IdentityServer4(客户端授权模式)

    1.新建三个项目 IdentityServer:端口5000 IdentityAPI:端口5001 IdentityClient: 2.在IdentityServer项目中添加IdentityServ ...

  3. IdentityServer4-Resource定义-翻译

    资源定义(Defining Resource) 通常,第一件事是定义那些你想保护的资源.这些资源可能是你的用户信息,比如个人数据,电子邮件或者对Api的访问. Note: 你可以用C#实体类来定义资源 ...

  4. vertx 从Tcp服务端和客户端开始翻译

    写TCP 服务器和客户端 vert.x能够使你很容易写出非阻塞的TCP客户端和服务器 创建一个TCP服务 最简单的创建TCP服务的方法是使用默认的配置:如下 NetServer server = ve ...

  5. AspNetCore中的IdentityServer4客户端认证模式实现

    1 AuthorizationServer using IdentityServer4; using IdentityServer4.Models; public class Startup { pu ...

  6. IdentityServer4客户端JWT解密实现(基于.net4.0)

    情景:公司项目基于.net4.0,web客户端实现单点登录需要自己解密id_token,对于jwt解密,.net提供了IdentityModel类库,但是4.0中该类库不可用,所以自己实现了解密方法. ...

  7. laravel 定义翻译字符串

    https://learnku.com/docs/laravel/5.6/localization/1376 // 全景链接$data['share_phone'] = trans('web.host ...

  8. IdentityServer4【Topic】之定义客户端

    Defining Clients 定义客户端 客户端表示哪些可以从你的IdentityServer拿到token的应用. 除了一些可能会变化的细节之外,通常情况下你需要为一个客户端定义如下通用的设置: ...

  9. ASP.NET Core的身份认证框架IdentityServer4(7)- 使用客户端证书控制API访问

    前言 今天(2017-9-8,写于9.8,今天才发布)一口气连续把最后几篇IdentityServer4相关理论全部翻译完了,终于可以进入写代码的过程了,比较累.目前官方的文档和Demo以及一些相关组 ...

随机推荐

  1. C# 最齐全的上传图片方法

    方法里包括了图片大小限制.图片尺寸.文件内容等等的判断... 该案例是mvc下的demo,支持单张图片上传. public ActionResult Upload() { string imgurl ...

  2. git 命令(补充篇)的本质理解

    1 标签, git tag tag_name SHA 本质: 在某次commit 上打上标签tag_name ,标签在代码库中起着"锚点"的作用. 注意: commit 由 SHA ...

  3. AJPFX:什么是外汇交易

    外汇交易是对货币对的一种买卖,是以一个国家货币与另外一个国家货币进行交换,即您在买入一国货币的同时,您也卖出了另一国的货币.所以在外汇市场上,人们的交易对象就是“货币对“,比如欧元/美元,美元/日元, ...

  4. linux安装方式

    一.rpm包安装方式步骤:  1.找到相应的软件包,比如soft.version.rpm,下载到本机某个目录: 2.打开一个终端,su -成root用户: 3.cd soft.version.rpm所 ...

  5. Android 从浏览器启动应用

    核心逻辑为AndroidMainfest.xml里面的指定Activity里增加配置: <intent-filter> <data android:scheme="***& ...

  6. ElasticSearch5.0之后的改变

    ES5的变化 search_type=count和scan都移除了 count可以用size=0代替 GET /my_index/_search { "size": 0, &quo ...

  7. [WINForm]C#应用程序图标设置问题

    在屏幕分辨率大小不一的情况下,应用程序的图标有些电脑显示合适,有些电脑显示在图标中间出现过多空白边距: 处理方式: 1.在vs中打开ico图片 2.在图标空白处右键添加新图像类型 3.选择自己需要的尺 ...

  8. linux下 /usr/bin/ld: 找不到 -ldhnetsdk的解决方法

    linux下使用Qt编译程序的时候,安装了程序自带的链接库之后,仍然上报这个错误, 发现系统上报这个错误: /usr/bin/ld: 找不到 -ldhnetsdk 经过仔细的定位,终于解决了,这里把思 ...

  9. Maven 常用的远程中央仓库地址

    https://repo1.maven.org/maven2/ http://maven.jahia.org/maven2/ http://maven.aliyun.com/nexus/content ...

  10. spring boot 集成 Listener 的两种方式

    1)@ServletComponentScan注解+@WebListener注解 2)@Bean注解+ServletListenerRegistrationBean类