希望很容易解决.
微软的System.IdentityModels.Tokens.Jwt软件包昨天在NuGet上更新4.0.2.206211351了v5.0.不幸的是,这导致了一些"标准" IdentityServer3代码的突破性变化.即从他们的代码示例中提取,所以我想很多开发人员可能会在未来几天看到这个问题.
使用v4.0.2.xxxxxx版本的软件包.我有
using System.IdentityModel.Tokens;
Run Code Online (Sandbox Code Playgroud)
在命名空间中.
然后在Configuration方法中开始如下:
public void Configuration(IAppBuilder app)
{
AntiForgeryConfig.UniqueClaimTypeIdentifier = "sub";
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>();
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{ ... };
Run Code Online (Sandbox Code Playgroud)
更新说明行后:
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>();
Run Code Online (Sandbox Code Playgroud)
造成问题.
第一件事就是Class显然已经进入了System.IdentityModel.Tokens.Jwt命名空间,这个解决方案并不是那么糟糕.
但是,我现在收到Object reference required for a non-static field错误JwtSecurityTokenHandler.InboundClaimTypeMap.
我是否在这里遗漏了一些东西,另一个需要的库或者在Startup.Configuration()被调用之前发生了什么需要深入研究?
经过几天令人沮丧的运行之后,我需要考虑在 VSCode 中调试 celery 工作进程。这是遵循 Celery 文档中创建消息处理程序的建议流程,而不是从同一应用程序发布/订阅。
celery.py 文件:
from __future__ import absolute_import, unicode_literals
import os
import json
from celery import Celery, bootsteps
from kombu import Consumer, Exchange, Queue
dataFeedQueue = Queue('statistical_forecasting', Exchange('forecasting_event_bus', 'direct', durable=False), 'DataFeedUpdatedIntegrationEvent')
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.local')
app = Celery('statistical_forecasting')
app.config_from_object('django.conf:settings', namespace='CELERY')
# Not required yet as handler is within this file
#app.autodiscover_tasks()
class DataFeedUpdatedHandler(bootsteps.ConsumerStep):
def get_consumers(self, channel):
return [Consumer(channel, queues=[dataFeedQueue], callbacks=[self.handle_message], accept=['json'])]
def handle_message(self, body, message):
event …Run Code Online (Sandbox Code Playgroud) 我知道这应该很简单,但如果能提供一点帮助,我们将不胜感激;我们对使用工业强度打字稿包都有些陌生。
我们正在构建一个 Angular 应用程序并使用 @azure/msal-angular 库,它在大多数情况下都可以正常工作;遵循教程和示例,通常都有意义。
除了在广播“msal:acquireTokenFailure”事件时要实现什么?
在 AppComponent 的 ngOnInit() 方法中,我们有这一行
// Subscriptions and redirects are for jwtTokens
this.subscription = this.broadcastService.subscribe("msal:acquireTokenFailure", () => {
// ToDo: What should be implemented here?
});
Run Code Online (Sandbox Code Playgroud)
在 GitHub 页面的一些帖子中,项目贡献者提出了一些类似的建议
// Subscriptions and redirects are for jwtTokens
this.subscription = this.broadcastService.subscribe("msal:acquireTokenFailure", () => {
this.subscription.unsubscribe();
this.authService.loginRedirect();
});
Run Code Online (Sandbox Code Playgroud)
就我而言,这将重定向到 AzuerAD 登录屏幕,但会丢失我们试图为其获取令牌的底层调用详细信息。
看起来更有用的(在伪代码中)是这样的
// Subscriptions and redirects are for jwtTokens
this.subscription = this.broadcastService.subscribe("msal:acquireTokenFailure", () => {
this.subscription.unsubscribe();
if (isIE) {
this.authService.acquireTokenRedirect(userRequest);
} else {
this.authService.acquireTokenPopup(userRequest);
}
}); …Run Code Online (Sandbox Code Playgroud)