问题标签 [identityserver4]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
4912 浏览

asp.net-mvc-5 - ASP.NET MVC 4.5.2 连接到 IdentityServer4

我有一个在 ASP.NET MVC 4.5.2 上运行的网站。我有一个 IdentityServer4 服务器正在运行,但是当我尝试对其进行身份验证时,我得到:

对于 ASP.NET Core MVC,文档有:

我在我的项目 Microsoft.Owin.Security.OpenIdConnect 中包含以下 NuGet 包。我的代码如下:

如何正确连接到它?

0 投票
1 回答
698 浏览

authentication - IdentityServer4,.net Core Web API;实现启用社交登录的个人用户帐户

我试图弄清楚以下是否可行以及如何完成:使用 IdentityServer4 在 .Net Core 中实现为 Web Api 启用的单个用户帐户登录,提供以下功能:-生成访问令牌,-生成刷新令牌,-启用社交登录 - 启用基于滚动的授权 - 使用本地数据库进行存储(EntityFramework...)

我无法使用可用的文档来控制它,我想知道是否有人以前做过类似的事情或者知道从哪里开始。

0 投票
2 回答
1802 浏览

asp.net-core - IdentityServer 4 and scope specific user settings

I plan to use IdentityServer 4 on ASP.NET Core with ASP.NET Identity as the data store. This is the first time I use a central authentication/authorization and I am wondering how to solve the following question:

Assume I have users with claims like name, role etc. and a Web API (scope) that allows these users access to measured values from hardware devices. IdentityServer will allow me to authenticate known users but now I need an access control that knows which users may access which device data.

Where do I store this information? Since it is specific to the scope I guess it should not be stored in the IdentityServers store. On the other hand, if I store it in the scopes own database I somehow need to connect it to the users defined in the IdentityServers store. Should I define user IDs that are unique to all scopes and IdentityServer?

0 投票
2 回答
2496 浏览

asp.net-mvc - IdentityServer MVC 令牌过期

我是身份服务器的新手,我的理解中缺少一个关键概念。我正在使用MVC 教程中的代码。

如果我用属性装饰我的 Home 控制器[Authorize]并访问我的网站,我会重定向到IdentityServer. 然后我使用我的用户名和密码登录。然后我使用一些自定义代码并进行身份验证。我取回了一个 AccessToken,然后我可以访问 Home 控制器。

我的客户端设置如下:

我的访问令牌是

当我将 my 设置AccessTokenLifetime为 1 时,我的令牌在发送以调用 API 等时将无效。但是,我仍然可以访问该网站。

让 MVC 网站确认我的令牌未过期的最佳方法是什么?这可能是刷新令牌发挥作用的地方。

注意AccessTokenLifetime设置为 1 仅用于测试,因此我可以快速测试 。

0 投票
2 回答
6440 浏览

c# - 使用客户端凭据流持久化令牌的最佳实践

我有一个允许匿名用户的 ASP.NET Core MVC 应用程序。这个应用程序正在调用一个受 Identity Server 4 保护的 ASP.NET Web API。我在 Identity Server 中创建了一个客户端,描述了 MVC 应用程序(客户端),并为其授予了对 api 范围的访问权限,如下所示:

在我的 MVC 应用程序中,我TokenClient用来获取一个令牌,在向受保护的 API 发出请求时可以使用该令牌,如下所示:

这很好用,但我在每次请求时都从 Identity Server 请求新令牌,这可能不是一个好主意。

处理令牌的最佳做法是什么?如何将它们持久保存在客户端(MVC 应用程序)上,如何处理刷新令牌以确保客户端在必要时获得新令牌?

0 投票
1 回答
917 浏览

asp.net-core - IdentityServer 和 Asp.net MVC

我正在构建一个应用程序,它是一个 Javascript SPA,后端带有 Asp.net mvc 控制器。我正在尝试使用 IdentityServer 进行身份验证。我在我的控制器上有授权属性。我的要求之一是用户的会话应该在一定时间内过期(如果没有活动,应该提示用户登录)。由于安全限制,隐式流程对我不起作用。我抓住了 Identity4 样本https://github.com/IdentityServer/IdentityServer4.Samples并尝试使用 cookieauthentication 中间件,设置 ExpireTimeSpan 以查看是否使 cookie 过期。不知何故,即使在指定的时间跨度到期后,我仍然可以调用控制器。如何使用 Identity Server 和 Asp.net mvc 完成类似于 asp.net 会话超时的操作?

0 投票
1 回答
1173 浏览

identityserver3 - IdentityServer4 隐式授权 acr 值

我正在尝试将租户 ID 作为参数传递给 identityserver4 隐式授权端点。客户端是使用 angularjs 编写的,是否有任何示例可以将租户 ID 从 Angular 应用程序传递到 identityserver4 端点。

我发现这个特性是使用 acr_values 实现的。更多细节在这里 - https://github.com/IdentityServer/IdentityServer3/issues/348

0 投票
1 回答
402 浏览

identityserver4 - IdentityServer4 问题

我正在使用 IdentityServer4 创建 Web API 安全性。我通过在控制台管理器中键入以下语法安装了 identityserver4 包:Install-Package IdentityServer4 -Pre。它安装成功。现在我无法在我的项目中引用它。这是我安装后的 project.json 代码:

所以现在我用以下代码创建了一个客户端类:

所以我得到了很多错误。当我将鼠标悬停在第一个客户端上时,我得到的唯一选项是 Add Package IdentityServer3 2.1.1

那么我如何引用 IdentityServer4 而不是 IdentityServer3 2.1.1

我期待着您的来信。

谢谢, 索马德

0 投票
1 回答
766 浏览

javascript - oidc-client CheckSessionIFrame 一次正确触发,然后在此后的任何时间间隔内都失败

这实际上可能不是 Identity Server 或 oidc-client 的问题,但我无法确定问题。我在 Aurelia 应用程序中通过 System.js 运行它,因此问题可能源自这些外部库之一。

CheckSessionIFrame.start(session_state)中,我们有以下代码:

间隔第一次触发时,似乎没有问题。iFrame 的 contentWindow 存在(如预期的那样)并且 postMessage 方法被调用而没有问题。两秒钟后,当间隔再次触发时,this._frame.contentWindow未定义 - 所以我最好的猜测是 iFrame 以某种方式死亡。同样,这可能不是 oidc-client 的问题,但我正在寻找任何可能导致此 iFrame 死机的有用指导(可能在内部它可能在脚本上死机?)例如缺少必要的配置值oidc 客户端。

0 投票
2 回答
347 浏览

mysql - 是否可以使用 dotnet core、具有身份验证和授权的 MySQL 构建 Web Api 应用程序?

我正在尝试使用

  1. 点网核心 1.0
  2. MySQL 作为数据存储
  3. 认证和授权
  4. 实体框架
  5. Ubuntu 16 机器

我已经成功创建了一个示例 API,以使用实体框架从 MySQL 数据库中获取数据。现在我想介绍使用电子邮件作为用户名和密码的身份验证。

我尝试了来自不同博客的几种方法,但无法实现。

我想要实现的是 api 的自定义身份验证,用户将在其中发送用户名和密码来登录 Api。登录 Api 将返回访问令牌和刷新令牌。使用此访问令牌,用户可以调用其他 API。

稍后我也想添加 Google 和 Facebook 身份验证。

有没有办法做到这一点?