Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dmsi ClientCredentials can't be loaded correctly even with ClientCredentials provided Error: System.ArgumentException: Delegate to an instance method cannot have null 'this' #3111

Open
Jiajun0815 opened this issue Oct 24, 2024 · 5 comments
Labels

Comments

@Jiajun0815
Copy link

Microsoft.Identity.Web Library

Microsoft.Identity.Web.OWIN

Microsoft.Identity.Web version

3.2.2

Web app

Sign-in users

Web API

Not Applicable

Token cache serialization

Not Applicable

Description

ClientCredentials which are not supposed to be needed are blocking us WebAppJWT_IDWeb_OWIN - Repos (visualstudio.com)

dmsi ClientCredentials can't be loaded correctly even with ClientCredentials provided Error: System.ArgumentException: Delegate to an instance method cannot have null 'this'

Reproduction steps

run the WebAppJWT_IDWeb_OWIN sample from https://msazure.visualstudio.com/One/_git/EngSys-Security-dSTS?path=%2fSecurity%2fSamples%2fJWTSamples%2fWebAppJWT_IDWeb_OWIN&version=GC71a7e2cc2f2b22f5d9637e2700a140239d408036

Error message

No response

Id Web logs

[ArgumentException: Delegate to an instance method cannot have null 'this'.]
System.MulticastDelegate.ThrowNullThisInDelegateToInstance() +60
Microsoft.Identity.Web.d__1.MoveNext() +596
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Identity.Web.d__24.MoveNext() +1668
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Identity.Web.d__23.MoveNext() +550
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Identity.Web.d__14.MoveNext() +410
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Identity.Web.<b__2>d.MoveNext() +768
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.OpenIdConnect.d__11.MoveNext() in //src/Microsoft.Owin.Security.OpenIdConnect/OpenidConnectAuthenticationHandler.cs:432
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
Microsoft.Owin.Security.OpenIdConnect.d__11.MoveNext() in /
/src/Microsoft.Owin.Security.OpenIdConnect/OpenidConnectAuthenticationHandler.cs:577
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.Infrastructure.d__31.MoveNext() in //src/Microsoft.Owin.Security/Infrastructure/AuthenticationHandler.cs:70
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.Infrastructure.d__5.MoveNext() in /
/src/Microsoft.Owin.Security/Infrastructure/AuthenticationMiddleware.cs:28
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__7.MoveNext() in //src/Microsoft.Owin.Host.SystemWeb/IntegratedPipeline/IntegratedPipelineContextStage.cs:85
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Security.Infrastructure.d__5.MoveNext() in /
/src/Microsoft.Owin.Security/Infrastructure/AuthenticationMiddleware.cs:30
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__7.MoveNext() in //src/Microsoft.Owin.Host.SystemWeb/IntegratedPipeline/IntegratedPipelineContextStage.cs:85
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__12.MoveNext() in /
/src/Microsoft.Owin.Host.SystemWeb/IntegratedPipeline/IntegratedPipelineContext.cs:153
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) in /_/src/Microsoft.Owin.Host.SystemWeb/IntegratedPipeline/StageAsyncResult.cs:76
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +505
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +182
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +134

Relevant code snippets

https://msazure.visualstudio.com/One/_git/EngSys-Security-dSTS?path=%2fSecurity%2fSamples%2fJWTSamples%2fWebAppJWT_IDWeb_OWIN&version=GC71a7e2cc2f2b22f5d9637e2700a140239d408036

Regression

No response

Expected behavior

user being able to login without ClientCredentials or dmsi works

@jmprieur
Copy link
Collaborator

The Microsoft.Identity.Client.dDMSI library does not take a dependency on the right ID Web, as MSAL changed the way to handle signed assertions (absorbed by IdWeb).
Also the sample does not use the right signed assertion

@Jiajun0815
Copy link
Author

I updated the Microsoft.Identity.Client.dDMSI library https://identitydivision.visualstudio.com/DevEx/_artifacts/feed/IDDP/NuGet/Microsoft.Identity.Client.Internal.dMSI/overview/1.4.0-preview1 to the latest but still got the same error @victorm-hernandez , the signed assertion we were using in the sample was SignedAssertionFromVault

@jmprieur
Copy link
Collaborator

@Jiajun0815 : do you mean you built it yourself based on my PR?

@jmprieur jmprieur added bug Something isn't working external and removed untriaged needs attention bug Something isn't working labels Oct 29, 2024
@Jiajun0815
Copy link
Author

@Jiajun0815 : do you mean you built it yourself based on my PR?

I built it based on this branch with Microsoft.Identity.Client.dDMSI 1.4.0-preview
image
what was the PR that you referred to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants