Skip to content
This repository has been archived by the owner on Jun 26, 2021. It is now read-only.

Retrieving All Delegated Roles using ADAL.js #713

Closed
RehanSaeed opened this issue Feb 12, 2018 · 7 comments
Closed

Retrieving All Delegated Roles using ADAL.js #713

RehanSaeed opened this issue Feb 12, 2018 · 7 comments

Comments

@RehanSaeed
Copy link

I have the following scenario:

SPA Application

  • User - Has a role with this name.

API Application

  • Resource.Read.All - Has a role with this name

SPA Group

  • Has the User and Resource.Read.All roles added as delegated permissions.

When I login using ADAL.js, the user object only contains the roles for the SPA:

const user = this.authenticationContext.getCachedUser();
const roles = user.roles; // Returns [ "User" ]

Is it possible to also retrieve the roles for the API application?

@navyasric
Copy link
Contributor

@RehanSaeed Can you clarify about the SPA Group? Is it a single application registration with a SPA and an API component? In order to receive the roles claims, you will need to configure your application manifest. Here is a .net sample which shows how the configuration steps which may apply to your app.

@RehanSaeed
Copy link
Author

It's as I've written above, two application registrations and a group in the Azure portal.

@RehanSaeed
Copy link
Author

To be clear. The API is a separate application to the SPA application and has separate application roles.

@nehaagrawal
Copy link
Contributor

@RehanSaeed can you please explain your user case. Why do you need the roles for both the SPA Application and the API?

@RehanSaeed
Copy link
Author

I was wondering if I could use the API roles to perform hide/show parts of the SPA instead of duplicating the role in both the SPA and API.

@AWR14
Copy link

AWR14 commented May 10, 2019

I want to show a different navigation items if the user is assigned to a certain group.

i can get the user but can't see where i get the groups, any working example of this?

const user = this.authenticationContext.getCachedUser();

@sameerag
Copy link
Member

Please check AzureAD/microsoft-authentication-library-for-js#1143 for this issue.

All current authentication work from microsoft is delivered through msal js library here. adal js is still supported only for security fixes. We would recommend to move to msal js for any advanced feature asks.

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

No branches or pull requests

5 participants