You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

.NET 4.6下ASP.NET MVC应用OAuth迁移至Azure OpenID Connect认证

当前OAuth配置及遇到的问题

应用配置代码

OAuthOptions = new OAuthAuthorizationServerOptions
{
    ApplicationCanDisplayErrors = true,                
    AuthorizeEndpointPath = new PathString("/Auth/Authorize"),
    TokenEndpointPath = new PathString("/Auth/Token"),
    AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(20),
    AccessTokenProvider = jwtProvider,
    Provider = new ApplicationOAuthProvider(PublicClientId)
};

BearerOptions = new OAuthBearerAuthenticationOptions
{
    AuthenticationType = OAuthDefaults.AuthenticationType,
    AuthenticationMode = AuthenticationMode.Active,
    AccessTokenProvider = jwtProvider
};

app.UseOAuthAuthorizationServer(OAuthOptions);
app.UseOAuthBearerAuthentication(BearerOptions);

查阅了一些论坛资料,但大多针对.NET Core;尝试通过Visual Studio连接服务创建默认应用,却未达到预期效果。

内容的提问来源于stack exchange,提问作者Siva Satya

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 12:32:06