【发布时间】:2020-09-24 20:54:39
【问题描述】:
BackGround : 用户一旦登录到我们的 Web 应用程序(使用应用程序级凭据),将看到他们想要使用的邮件系统,基于该用户将被重定向到相应的授权服务器以验证(使用他们邮件系统的登录名/密码),验证服务器将返回一个访问令牌。
在 OnAuthorizationCodeReceivedAsync 或 OnAuthenticationFailedAsync 等通知事件中;我们没有得到 ASP.NET_SessionId,所以我不能使用在 OAuth Flow 之前设置的任何会话值。
更多详情请参阅下面的代码。
app.UseOpenIdConnectAuthentication(New OpenIdConnectAuthenticationOptions With {
.ClientId = appId,
.ClientSecret = appSecret,
.Authority = "https://login.microsoftonline.com/common/v2.0",
.Scope = $"openid email profile offline_access {ewsScopes}",
.RedirectUri = redirectUri,
.PostLogoutRedirectUri = redirectUri,
.TokenValidationParameters = New TokenValidationParameters With {
.ValidateIssuer = False
},
.Notifications = New OpenIdConnectAuthenticationNotifications With {
.AuthenticationFailed = AddressOf OnAuthenticationFailedAsync,
.AuthorizationCodeReceived = AddressOf OnAuthorizationCodeReceivedAsync
}
})
我无法在 HttpConext.Current.Session 中获取在通知事件中 OAuth 流之前设置的任何会话值。
根据以下 SO;我尝试了不同的方法,例如 SystemWebCookieManager、UseKentorOwinCookieSaver,但问题没有解决。
ASP.NET_SessionId + OWIN Cookies do not send to browser
可能是什么问题,我该如何解决?
【问题讨论】:
-
我认为这个 SO 答案可能会对您有所帮助。 link
-
@Borka - 我试过了,但对我没用。
标签: asp.net asp.net-mvc asp.net-identity owin katana