-
Notifications
You must be signed in to change notification settings - Fork 373
Create FmiCredential.md proposal #5309
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f4364f0
Create FmiCredential.md proposal
trwalke f0de9c3
Update FmiCredential.md
trwalke 479d9f0
Update FmiCredential.md
trwalke 33e99eb
Update FmiCredential.md
trwalke fa6c1dc
Update FmiCredential.md
trwalke 93d0ed7
Merge branch 'main' into trwalke/FmiCredential
trwalke f4952e2
Update FmiCredential.md
trwalke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
|
||
# Proposal: Migrating HTTP Client Logic from MISE's FMI Credential to MSAL's Managed Identity | ||
|
||
## Overview | ||
This proposal outlines the rationale and design for moving the HTTP client logic used to acquire an FMI credential currently implemented in MISE to the MSAL Managed Identity application. The credential is retrieved from an endpoint specified by the `APP_IDENTITY_ENDPOINT` and is used as a client credential for another MSAL application. This credential is an implementation of IdWebs `ClientAssertionProviderBase`. This logic can be seen here: [ServiceFabricFmiClientAssertionProvider.cd](https://identitydivision.visualstudio.com/DevEx/_git/MISE?path=/src/Fmi/ServiceFabricFmiClientAssertionProvider.cs) The credential logic from this file will be moved to MSAL so that MSAL can acquire the FMi credential using its existing service fabric managed identity source and handle issues related to the http client. | ||
|
||
## Motivation | ||
- **Low-Level HTTP Handling**: The existing logic is implemented at a low level, which is inconsistent with the abstraction provided by MSAL and its service fabric integration. | ||
- **MSAL Enhancements**: MSAL includes numerous improvements and bug fixes for Managed Identity and service fabric communication, particularly in HTTP client handling and retry logic. | ||
- **Complex Integration**: Exposing the updated HTTP client logic to MISE would require significant additional logic in both MSAL and MISE, leading to increased complexity and maintenance overhead. | ||
- **Code Consolidation**: Centralizing the logic within MSAL ensures a cleaner, more maintainable architecture and aligns with the principle of single responsibility. | ||
|
||
## Proposed Design | ||
To support this migration, I propose two approaches: | ||
|
||
### 1. Explicit API | ||
Introduce a dedicated API in MSAL to enable this flow explicitly, such as `WithServiceFabricFmi()`. This makes the integration clear and controlled. This will be chained off of the AcquireTokenParameterBuilder for MI apps. | ||
|
||
```csharp | ||
var managedIdentityApp = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.SystemAssigned) | ||
.WithExperimentalFeatures() | ||
.WithServiceFabricFmi() | ||
.Build(); | ||
|
||
var result = await managedIdentityApp.AcquireTokenForManagedIdentity(someResource) | ||
.ExecuteAsync() | ||
.ConfigureAwait(false); | ||
``` | ||
|
||
|
||
### 2. Implicit Trigger via Resource Detection | ||
Automatically trigger the logic when a specific FMI resource is detected. This approach minimizes the need for explicit configuration and supports backward compatibility. | ||
|
||
```csharp | ||
var managedIdentityApp = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.SystemAssigned) | ||
.WithExperimentalFeatures() | ||
.Build(); | ||
|
||
var result = await managedIdentityApp.AcquireTokenForManagedIdentity("api://AzureFMITokenExchange/.default") //Or the GUID version | ||
.ExecuteAsync() | ||
.ConfigureAwait(false); | ||
``` | ||
|
||
## Benefits | ||
- **Improved Maintainability**: Reduces duplication and isolates credential acquisition logic within MSAL. | ||
- **Enhanced Reliability**: Leverages MSAL’s robust HTTP handling and retry mechanisms. | ||
- **Cleaner Integration**: Avoids polluting MISE with service fabric-specific logic. | ||
- **Future-Proofing**: Positions the system for easier upgrades and enhancements as MSAL evolves. | ||
|
||
## Other Considerations | ||
|
||
- The tokens should not be cached. Caching will be handled in the other MSAL applicaiton that uses this token. MISE will expect to get a new token each time this flow is used. | ||
- To reduce the footprint of this logic, the managed identity application used to create this can use a system assigned identity. | ||
- Should this logic stay behind the expiremental features flag as it will only be used by MISE and is not intended for public use. | ||
trwalke marked this conversation as resolved.
Show resolved
Hide resolved
|
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.
Uh oh!
There was an error while loading. Please reload this page.