-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
The MSAL Interceptor finds invalid resources from the endpoint if another match is found in "QueryString". #7111
Comments
This PR addresses a bug where the `MsalInterceptor` could match the protectedResource to the query string part of the URL instead of the host name and port part of the URL. It also refactors the code surrounding relative URLs. This addresses issue #7111
@SuperPanda911 Thanks for the catch. A fix for this bug has been merged and will be available in the next MSAL Angular release. Closing as completed. |
Thank you very much for the fix. I am waiting for release. |
This change broke my app. I had to change: To this: It appears that wildcards for origin are no longer supported. |
Same |
same ➕1️⃣ |
What happened to this change? it's never merged! |
I fixed the issue again using a different approach to address a new problem caused by the previous change. I pushed the commit, but I haven't received any response from the developers even after 2 months. |
Core Library
MSAL.js (@azure/msal-browser)
Core Library Version
3.0.15
Wrapper Library
MSAL Angular (@azure/msal-angular)
Wrapper Library Version
2.0.0
Public or Confidential Client?
Public
Description
Our Angular application uses multiple resources, each of which requires a separate token. We use "MsalInterceptorConfiguration" to specify these resources.
The order of the resources affects the reception of the error.
Everything works fine until a request happens that contains two endpoints URLs in the request.
As an example, here is such a request:
https://MY_API_SITE_1/api/sites?$filter=siteUrl eq 'https://MY_API_SITE_2'
In the code, the request address is passed in full (
req.url
), and problems arise with thisthis.getScopesForEndpoint(req.url, req.method)
MSAL interceptor
Then in the "matchResourcesToEndpoint" method we additionally receive an unnecessary resource from
protectedResourcesEndpoints
because it's in the full URLendpoint
MSAL interceptor
Then I have a warning that more than one match was found
allMatchedScopes
and thematchScopesToEndpoint
function returns me the first element of the arrayreturn allMatchedScopes[0]
.And if the resource order doesn't match, then I don't get a token for the correct resource.
MSAL interceptor
This may not be a very common problem, but it can occur when using multiple related resources and is very annoying.
Error Message
No response
MSAL Logs
No response
Network Trace (Preferrably Fiddler)
MSAL Configuration
Relevant Code Snippets
Reproduction Steps
https://MY_API_SITE_1
using a QueryString that contains a URL to the second resourcehttps://MY_API_SITE_1/api/sites?$filter=siteUrl eq 'https://MY_API_SITE_2'
Expected Behavior
When sending a request, the interceptor should not take into account the QueryString parameters, so that there are no incorrect matches when issuing tokens
Identity Provider
Entra ID (formerly Azure AD) / MSA
Browsers Affected (Select all that apply)
Chrome, Firefox, Edge, Safari, None (Server), Other
Regression
No response
Source
External (Customer)
The text was updated successfully, but these errors were encountered: