- 
                Notifications
    You must be signed in to change notification settings 
- Fork 241
Add Guid-based overload for Agent User Identity to support OID in addition to UPN #3513
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
Add Guid-based overload for Agent User Identity to support OID in addition to UPN #3513
Conversation
Co-authored-by: jmprieur <[email protected]>
| Very good start, @copilot | 
Co-authored-by: jmprieur <[email protected]>
| 
 Updated README.AgentIdentities.md to document the new OID-based overload. The README now shows both UPN and OID usage patterns for Agent User Identity across all integration scenarios (direct API calls, Microsoft Graph, and Downstream APIs). Commit: 0d568e2 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks
Co-authored-by: jmprieur <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
        
          
                src/Microsoft.Identity.Web.AgentIdentities/AgentUserIdentityMsalAddIn.cs
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, small comment on the caching and naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than @bgavrilMS's comments LGTM
Fixes #3512
UserIdKeyconstant to Constants.cs to carry user OID in ExtraParametersWithAgentUserIdentity(string agentApplicationId, Guid userId)to AgentIdentitiesExtension.csAgentUserIdentityGetsTokenForGraphByUserIdAsyncto verify OID-based flowSummary of Changes
Successfully implemented feature request #3512 to support passing either UPN or user OID (Guid) to WithAgentUserIdentity for Agent Identities.
Core Implementation:
Constants.UserIdKey = "IDWEB_USER_ID"internal constantWithAgentUserIdentity(string agentApplicationId, Guid userId)AgentUserIdentityMsalAddInto check for bothUsernameKeyandUserIdKeyuser_idwhen OID is provided,usernamewhen UPN is providedTokenAcquisition.TryGetAuthenticationResultForConfidentialClientUsingRopcAsyncto recognize OID pathDocumentation:
Testing:
Backward Compatibility:
Original prompt
Implements feature request #3512 to allow passing either a UPN or a user OID (Guid) to WithAgentUserIdentity for Agent Identities.
Summary
Acceptance criteria
Edits to apply