【问题标题】:Need a sample implementation for AddRemoteScheme in ASP.NET需要 ASP.NET 中 AddRemoteScheme 的示例实现
【发布时间】:2019-12-11 10:04:49
【问题描述】:

我有一个后端应用程序(例如 API-A),它使用我自定义实现的 IAM 解决方案(例如 IAM-I)对传入请求进行身份验证。本质上,我将请求标头中的几个令牌传递给 IAM-I,IAM-I 处理它们并决定请求是否经过身份验证。

我正在尝试创建一个远程身份验证方案以从 API-A 调用 IAM-I。如何创建自己的 AuthenticationBuilder.AddRemoteSchemeMicrosoft.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#


【解决方案1】:

您的 IAM 解决方案是否使用 JWT 令牌?

JwtBearerDefaults 仅支持 JWT 令牌,如果您的 IAM 解决方案使用 OpenID Connect,那么您应该使用 AddJwtBearer 来保护 API。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多