-
Notifications
You must be signed in to change notification settings - Fork 241
Add agent identity extension methods for ClaimsPrincipal and ClaimsIdentity #3515
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 agent identity extension methods for ClaimsPrincipal and ClaimsIdentity #3515
Conversation
Co-authored-by: jmprieur <[email protected]>
…s project Co-authored-by: jmprieur <[email protected]>
jmprieur
left a comment
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/AgentIdentityExtensions.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.AgentIdentities/AgentIdentityExtensions.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: keegan-caruso <[email protected]>
|
@copilot : let's add other asserts using the ClaimsIdentity extension methods in the Agent identity end to end tests under When the test gets the authorization header, extract the token, read it with JsonWebTokenHandler, and create an untrusted claims identity from the claims in the token. |
Co-authored-by: jmprieur <[email protected]>
Added assertions in all four AgentUserIdentityTests methods (722ac3b). Each test now extracts the token from the authorization header, parses it with JwtSecurityTokenHandler, creates a CaseSensitiveClaimsIdentity from the claims, and uses IsAgentUserIdentity() and GetParentAgentBlueprint() extension methods to validate the token. |
jmprieur
left a comment
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.
@copilot : this is great, I left comments.,
Could we also assert the 2 extension methods on ClaimsIndentity in Autonomous agent tests as well?
Original prompt
Title: Add agent identity extension methods: GetParentAgentBlueprint and IsAgentUserIdentity
Summary
Add extension methods on ClaimsPrincipal and ClaimsIdentity to help developers detect agent identities and retrieve the parent agent blueprint from token claims.
Requirements
Add the following extension methods in a new file under src/Microsoft.Identity.Web.TokenCache:
Add unit tests under tests/Microsoft.Identity.Web.Test to validate the above behaviors.
Notes
Proposed changes