Closed gheibia closed 2 years ago
Alternatively, I can update the existing microsoftUnverifiedClaims
struct and add a field for Roles
. Keep everything else as is and simply copy the roles from microsoftUnverifiedClaims
to Claims
struct's new map.
Hello, was wondering if someone could give me a feedback on this. I'd like to start working on this.
This is now merged on master :)
Could you please point me to the PR? Neither Claims
struct nor Microsoft Provider
seem to have been changed.
Awesome! I'm gonna try this. Thank you.
Preflight checklist
Describe your problem
Current Claim struct only support common claims amongst all providers. There is no way to include optional claims.
For instance, with Azure AD one can add Application Roles to the ID Token: https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-add-app-roles-in-azure-ad-apps
These roles could then be added to an identity's metadata or traits to be used later (e.g.: Fine-grained authorization).
Describe your ideal solution
I thought about different solutions and the one that stood out to me and is least impactful is this (I can put out a PR if needed):
Claims
struct to include amap[string]string
for optional claims.verifyAndDecodeClaimsWithProvider
(from the embeddedProviderGenericOIDC
) to populate the newmap
when building aclaims
object. This requires:microsoftClaims
) to Microsoft Provider embeddingClaims
struct. This new struct will contain any new claim in the ID Token as a field. We'll pass a reference to amicrosoftClaims
object to theClaims
method ofgoodic.IDToken
instead.microsoftClaims
toClaims
' new optional claims map.With this approach any provider that needs extra claims can implement this method and populate them in the new
map
.Workarounds or alternatives
I couldn't find a work around for this. There are endpoints in Azure AD which I can call (using hooks for example) to get assigned roles, but they need elevated permissions.
Version
0.10.1
Additional Context
No response