-
Notifications
You must be signed in to change notification settings - Fork 353
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
Adding FMI Integration tests #5149
base: main
Are you sure you want to change the base?
Conversation
tests/Microsoft.Identity.Test.Integration.netcore/HeadlessTests/FmiIntegrationTests.cs
Outdated
Show resolved
Hide resolved
[TestClass] | ||
public class FmiIntegrationTests | ||
{ | ||
private const string _fmiAppUrn = "urn:microsoft:identity:fmi"; |
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.
style for constants is different I believe. SomeConstant
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.
We should add an analyzer for it
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.
tests/Microsoft.Identity.Test.Integration.netcore/HeadlessTests/FmiIntegrationTests.cs
Outdated
Show resolved
Hide resolved
tests/Microsoft.Identity.Test.Integration.netcore/HeadlessTests/FmiIntegrationTests.cs
Outdated
Show resolved
Hide resolved
.ExecuteAsync() | ||
.ConfigureAwait(false); | ||
|
||
MsalAssert.AssertAuthResult(authResult); |
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.
What you should really assert on is:
- the cache key (internal and external)
- the sub claim of the token
- the aud claim of the token
- other claims?
So I suggest you do all the checks inline.
tests/Microsoft.Identity.Test.Integration.netcore/HeadlessTests/FmiIntegrationTests.cs
Outdated
Show resolved
Hide resolved
tests/Microsoft.Identity.Test.Integration.netcore/HeadlessTests/FmiIntegrationTests.cs
Show resolved
Hide resolved
tests/Microsoft.Identity.Test.Integration.netcore/HeadlessTests/FmiIntegrationTests.cs
Outdated
Show resolved
Hide resolved
tests/Microsoft.Identity.Test.Integration.netcore/HeadlessTests/FmiIntegrationTests.cs
Outdated
Show resolved
Hide resolved
tests/Microsoft.Identity.Test.Integration.netcore/HeadlessTests/FmiIntegrationTests.cs
Outdated
Show resolved
Hide resolved
tests/Microsoft.Identity.Test.Integration.netcore/HeadlessTests/FmiIntegrationTests.cs
Show resolved
Hide resolved
tests/Microsoft.Identity.Test.Integration.netcore/HeadlessTests/FmiIntegrationTests.cs
Outdated
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.
These tests are not easy to read
"expectedAudience"); | ||
} | ||
|
||
private static async Task<string> GetParentCredential(AssertionRequestOptions options) |
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.
Added the assertion logic to a private method. It seemed like too much code to have this in every test. This is also how JM has it in his spec
.BuildConcrete(); | ||
|
||
//Configure token cache serialization | ||
confidentialApp.AppTokenCache.SetBeforeAccess(BeforeCacheAccess); |
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.
Can you pls use the static cache here? And update the TestBase to delete the static cache on every test.
|
||
//Fmi app/scenario parameters | ||
var clientId = "4df2cbbb-8612-49c1-87c8-f334d6d065ad"; | ||
var scope = "api://AzureFMITokenExchange/.default"; |
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.
nit: no reason for these variables.
namespace Microsoft.Identity.Test.Integration.NetCore.HeadlessTests | ||
{ | ||
/// <summary> | ||
/// The tests in this file are demonstrations of the various authentication flows outlined in the "FMI protocol spec v1.0" Section 3.2 |
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.
/// The tests in this file are demonstrations of the various authentication flows outlined in the "FMI protocol spec v1.0" Section 3.2 | |
/// The tests in this file are demonstrations of the various authentication flows outlined in the "FMI protocol spec v1.0" Section 3.2 | |
/// https://microsoft.sharepoint.com/:w:/t/aad/protocols/EThMH6es0UNKhsFlVgBiBegByuZQ6CnaCzzAdAV0excHVA?e=m5xXtV |
|
||
//Fmi app/scenario parameters | ||
var clientId = "4df2cbbb-8612-49c1-87c8-f334d6d065ad"; | ||
var scope = "022907d3-0f1b-48f7-badc-1ba6abab6d66/.default"; |
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.
nit: Maybe add a comment of what this resource represents
|
||
//Acquire Token | ||
var authResult = await confidentialApp.AcquireTokenForClient(new[] { scope }) | ||
.WithFmiPath("SomeFmiPath/Path") //Sets fmi path in client credential request. |
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.
We should have a different FMI path for the credential.
Fixes #
Changes proposed in this request
Testing
Performance impact
Documentation