【发布时间】:2019-12-11 10:04:49
【问题描述】:
我有一个后端应用程序(例如 API-A),它使用我自定义实现的 IAM 解决方案(例如 IAM-I)对传入请求进行身份验证。本质上,我将请求标头中的几个令牌传递给 IAM-I,IAM-I 处理它们并决定请求是否经过身份验证。
我正在尝试创建一个远程身份验证方案以从 API-A 调用 IAM-I。如何创建自己的 AuthenticationBuilder.AddRemoteScheme 和 Microsoft.AspNetCore.Authentication.RemoteAuthenticationOptions 实例来实现这一点?
我写了这个:
iServiceCollection
.AddAuthentication(fun options ->
options.DefaultScheme <- JwtBearerDefaults.AuthenticationScheme
options.DefaultChallengeScheme <- JwtBearerDefaults.AuthenticationScheme)
.AddRemoteScheme("IAM-I Scheme", "IAM-I", remoteAuthAction)
let remoteAuthAction: Action<RemoteAuthenticationOptions> = new Action<RemoteAuthenticationOptions>(fun options ->
................ **TO BE FILLED** .................
);
谁能帮我弄清楚如何实现RemoteAuthenticationOptions?我在网上找不到任何示例。
上面的 sn-p 在 F# 中,但我可以使用 F# 或 C#。
【问题讨论】:
-
你找到样品了吗?
标签: c# asp.net .net authentication f#