具有OIDC授权的mapblazorhub'对象引用未设置为对象的实例'
我在OIDC授权方面有问题。授权有效,但给我带来了2个与SignalR相关的例外。我不知道该怎么办。堆栈跟踪和异常消息都没有告诉我任何事情。
第一个例外:
对象引用未设置为对象的实例。
堆栈跟踪:
在microsoft.aspnetcore.signalr.clientproxyextensions.sendasync(iclientproxy clientproxy,字符串方法,object arg1,object arg2,object arg2,object arg3,cancellationToken concellationtoken)
第二个例外:
对象引用未设置为对象的实例。
堆栈跟踪:
在microsoft.aspnetcore.signalr.clientproxyextensions.sendasync(iclientproxy clientproxy,字符串方法,object arg1,object arg1,object arg2,object arg2,object arg3,concellationToken concellationtoken)) 在microsoft.aspnetcore.com.ponents.server.circuits.remotejsruntime.endinvokedotnet(dotnetinvocationinfo InvocationInfo,dotnetnetinvocation& invocationResult)) 在Microsoft.jsinterop.infrastructure.dotnetdispatcher.endinvokedotnetaftertask(任务任务,jsruntime jsruntime,dotnetinvocationinfo& invocationInfo)) 在microsoft.jsinterop.infrastructure.dotnetdispatcher。 at System.Threading.tasks.continationTaskFromTask.innerinvoke() 在System.Threading.tasks.task。 在System.Threading.executionContext.runfromthreadpooldispatchloop(treenTHREDPOOLTHREAD,executionContext executionContext,ContextCallback Callback,Object State)) ---从上一个位置的堆栈跟踪结束--- 在system.runtime.exceptionservices.exceptiondispatchinfo.throw()
异常重定向到OIDC授权时弹出。
OIDC配置:
.AddOpenIdConnect("oidc", options =>
{
options.Authority = configuration.GetSection("Authentication")["oidc:Authority"];
options.ClientId = configuration.GetSection("Authentication")["oidc:ClientId"];
options.ClientSecret = configuration.GetSection("Authentication")["oidc:ClientSecret"];
options.RequireHttpsMetadata = false;
options.GetClaimsFromUserInfoEndpoint = true;
options.SaveTokens = true;
options.RemoteSignOutPath = "/SignOut";
options.SignedOutRedirectUri = "/login-callback";
options.ResponseType = "code";
options.BackchannelHttpHandler = new HttpClientHandler
{
UseProxy = false,
UseDefaultCredentials = true
};
})
调用OIDC授权:
public async Task OnGet()
{
await HttpContext.ChallengeAsync("oidc", new AuthenticationProperties { RedirectUri = "/login-callback" });
}
I have a problem with oidc authorization. Authorization works but throws me 2 exceptions related to SignalR. I have no idea what to do with it. Neither the stack trace nor the exception message tells me anything.
First Exception:
Object reference not set to an instance of an object.
Stack Trace:
at Microsoft.AspNetCore.SignalR.ClientProxyExtensions.SendAsync(IClientProxy clientProxy, String method, Object arg1, Object arg2, Object arg3, CancellationToken cancellationToken)
Second Exception:
Object reference not set to an instance of an object.
Stack trace:
at Microsoft.AspNetCore.SignalR.ClientProxyExtensions.SendAsync(IClientProxy clientProxy, String method, Object arg1, Object arg2, Object arg3, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.EndInvokeDotNet(DotNetInvocationInfo invocationInfo, DotNetInvocationResult& invocationResult)
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.EndInvokeDotNetAfterTask(Task task, JSRuntime jsRuntime, DotNetInvocationInfo& invocationInfo)
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.<>c__DisplayClass5_0.b__0(Task t)
at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Exceptions pop up when redirected to oidc authorization.
OIDC Configuration:
.AddOpenIdConnect("oidc", options =>
{
options.Authority = configuration.GetSection("Authentication")["oidc:Authority"];
options.ClientId = configuration.GetSection("Authentication")["oidc:ClientId"];
options.ClientSecret = configuration.GetSection("Authentication")["oidc:ClientSecret"];
options.RequireHttpsMetadata = false;
options.GetClaimsFromUserInfoEndpoint = true;
options.SaveTokens = true;
options.RemoteSignOutPath = "/SignOut";
options.SignedOutRedirectUri = "/login-callback";
options.ResponseType = "code";
options.BackchannelHttpHandler = new HttpClientHandler
{
UseProxy = false,
UseDefaultCredentials = true
};
})
Calling oidc authorization:
public async Task OnGet()
{
await HttpContext.ChallengeAsync("oidc", new AuthenticationProperties { RedirectUri = "/login-callback" });
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论