Add User Federated Identity Credential (user_fic) grant type support#1026
Open
Avery-Dunn wants to merge 3 commits intoavdunn/fmi-supportfrom
Open
Add User Federated Identity Credential (user_fic) grant type support#1026Avery-Dunn wants to merge 3 commits intoavdunn/fmi-supportfrom
user_fic) grant type support#1026Avery-Dunn wants to merge 3 commits intoavdunn/fmi-supportfrom
Conversation
| } | ||
|
|
||
| // ======================================================================== | ||
| // §6: user_fic grant type |
Contributor
There was a problem hiding this comment.
Strange that this starts from 6
Contributor
Author
There was a problem hiding this comment.
The agent wrote this and some other comments with references to sections in some docs and some behavior in .NET it was using as examples.
In the latest commit I've cleaned up all the comments to remove that sort of stuff.
Contributor
neha-bhargava
left a comment
There was a problem hiding this comment.
Overall looks good. I would like to see some end to end tests as well where an assertion is built and passed to user fic. The test setup is up and working and used in MISE PR.
user_fic) grant type support
c94ca99 to
07bdbb7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for the
user_fic(User Federated Identity Credential) grant type to MSAL Java, enabling Leg 3 of the agent identity protocol. This allows an agent application to exchange a federated identity credential (obtained from Leg 2's instance token) for a user-scoped access token, enabling the agent to act on behalf of a specific user.What's included
New public APIs:
IConfidentialClientApplication.acquireToken(UserFederatedIdentityCredentialParameters)— acquires a user-scoped token using theuser_ficgrant typeUserFederatedIdentityCredentialParameters— parameter object with builder pattern, supporting:.builder(scopes, username, assertion)— identify user by UPN.builder(scopes, userObjectId, assertion)— identify user by Object ID (UUID).forceRefresh(boolean)— bypass cache and hit IdP.tenant(String)— override tenant.claims(ClaimsRequest)— claims challenge support.extraHttpHeaders(Map)/.extraQueryParameters(Map)— extensibilityToken request behavior:
grant_type=user_ficin the POST bodyuser_federated_identity_credential=<T2>(the instance token from Leg 2)user_id=<OID>orusername=<UPN>(mutually exclusive, enforced by API design)openid,profile,offline_access(user-flow behavior, not app-flow)client_info=1to receive account information in the responseCache behavior:
forceRefresh=true)findCachedAccount()which matches by OID (homeAccountId prefix) or UPN (case-insensitive), with a single-account fallback for format mismatchesInternal changes:
AcquireTokenByUserFederatedIdentityCredentialSupplier— orchestrates cache-then-network logic, includingfindCachedAccount()for silent lookupUserFederatedIdentityCredentialRequest— constructs the OAuth2 grant with correct parametersGrantConstants.USER_FIC— new grant type constantConfidentialClientApplication.acquireToken(UserFederatedIdentityCredentialParameters)— routes to the new supplierPublicApi.ACQUIRE_TOKEN_BY_USER_FEDERATED_IDENTITY_CREDENTIAL— telemetry enumTests:
UserFederatedIdentityCredentialTest.java— 19 unit tests covering:FicIT.java— 4 integration tests matching MSAL .NET's agentic FIC coverage (user_fic with UPN, user_fic with OID, cache isolation between app and user tokens, multi-user cache correctness)AgenticIT.java— expanded with 2 additional FIC integration tests (agent acquiring user token for Graph, app+user token cache isolation)Alignment with MSAL .NET
This implementation matches the
user_ficbehavior on MSAL .NET'smainbranch. Key equivalences:AcquireTokenByUserFederatedIdentityCredential(scopes, username, assertion)acquireToken(UserFederatedIdentityCredentialParameters.builder(scopes, username, assertion).build())WithForceRefresh(true).forceRefresh(true)findCachedAccount()grant_type=user_fic+ scope augmentation +client_info=1Differences from .NET (intentional)
username(UPN)usernameanduserObjectId(UUID)AcquireTokenSilentseparately