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

wildcard for protectedResourceMap ? #1776

Closed
1 of 5 tasks
gIt-SpLasHeR opened this issue Jun 12, 2020 · 2 comments · Fixed by #2029
Closed
1 of 5 tasks

wildcard for protectedResourceMap ? #1776

gIt-SpLasHeR opened this issue Jun 12, 2020 · 2 comments · Fixed by #2029
Assignees
Labels
enhancement Enhancement to an existing feature or behavior. msal-angular Related to @azure/msal-angular package question Customer is asking for a clarification, use case or information.

Comments

@gIt-SpLasHeR
Copy link

gIt-SpLasHeR commented Jun 12, 2020

Please follow the issue template below. Failure to do so will result in a delay in answering your question.

Library

  • msal@1.x.x or @azure/msal@1.x.x
  • @azure/msal-browser@2.x.x
  • @azure/msal-angular@0.x.x
  • @azure/msal-angular@1.x.x
  • @azure/msal-angularjs@1.x.x

Description

msal interceptor will attach the token to the requests which url & scope listed in "protectedResourceMap" as below format
protectedResourceMap: [ ['https://graph.microsoft.com/v1.0/me', ['user.read']] ]
since in my situation i got some urls with same scope.
so is it possible to use a wild card url in protectedResourceMap?
which similar like this
protectedResourceMap: [ ['https://*.microsoft.com/*', ['user.read']] ]

or

protectedResourceMap: [ ['*', ['user.read']] ]

@gIt-SpLasHeR gIt-SpLasHeR added the question Customer is asking for a clarification, use case or information. label Jun 12, 2020
@jasonnutter jasonnutter added msal-angular Related to @azure/msal-angular package enhancement Enhancement to an existing feature or behavior. labels Jun 15, 2020
@jasonnutter
Copy link
Contributor

jasonnutter commented Jun 15, 2020

@gItSpLasHeR This is a reasonable ask, we'll track it and follow up when we have a chance to address, thanks!

@vitaliidasaev
Copy link

vitaliidasaev commented Jun 18, 2020

I've made own implementation of MsalInterceptor to overcome issues with protectedResourceMap.
This is my custom code block:

// #region own workaround in order not to put every api endpoint url to settings
if (!scopes && req.url.startsWith(this.settingsService.apiUrl)) {
  scopes = [this.auth.getCurrentConfiguration().auth.clientId];
}
// #endregion

// If there are no scopes set for this request, do nothing.
if (!scopes) {
  return next.handle(req);
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Enhancement to an existing feature or behavior. msal-angular Related to @azure/msal-angular package question Customer is asking for a clarification, use case or information.
Projects
None yet
4 participants