Skip to content

Commit

Permalink
Update the appId (#2715)
Browse files Browse the repository at this point in the history
* Update the appId

* Fixing tests due to directory clean-up
Disabling UI tests that require MFA until we find a solution to #2716
  • Loading branch information
jmprieur authored Mar 24, 2024
1 parent e85d9c9 commit 4d58560
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task<ActionResult> SayHello()
var channel = GrpcChannel.ForAddress("https://localhost:5001");
var client = new Greeter.GreeterClient(channel);

string token = await _tokenAcquisition.GetAccessTokenForUserAsync(new string[] { "api://a4c2469b-cf84-4145-8f5f-cb7bacf814bc/access_as_user" }).ConfigureAwait(false);
string token = await _tokenAcquisition.GetAccessTokenForUserAsync(new string[] { "api://1e2fb196-50ce-4652-a4f9-26c1bf2e826b/access_as_user" }).ConfigureAwait(false);

var headers = new Metadata();
headers.Add("Authorization", $"Bearer {token}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@
},
"TodoList": {
// TodoListScope is the scope of the Web API you want to call.
"Scopes": [ "api://a4c2469b-cf84-4145-8f5f-cb7bacf814bc/access_as_user" ],
"Scopes": [ "api://1e2fb196-50ce-4652-a4f9-26c1bf2e826b/access_as_user" ],
"BaseUrl": "http://localhost:44350"

},
"SayHello": {
// Scope for the web API set up w/gRPC
"Scopes": [ "api://a4c2469b-cf84-4145-8f5f-cb7bacf814bc/access_as_user" ],
"Scopes": [ "api://1e2fb196-50ce-4652-a4f9-26c1bf2e826b/access_as_user" ],
"BaseUrl": "https://localhost:5001"
},
"AzureFunction": {
// Scope for the web API set up Azure function
"Scopes": [ "api://a4c2469b-cf84-4145-8f5f-cb7bacf814bc/access_as_user" ],
"Scopes": [ "api://1e2fb196-50ce-4652-a4f9-26c1bf2e826b/access_as_user" ],
"BaseUrl": "http://localhost:7071/api/SampleFunc"
},
"TodoListJwe": {
// Scope for the web API used with the token decryption certificates.
"Scopes": [ "api://a4c2469b-cf84-4145-8f5f-cb7bacf814bc/access_as_user" ],
"Scopes": [ "api://1e2fb196-50ce-4652-a4f9-26c1bf2e826b/access_as_user" ],
"BaseUrl": "https://localhost:44350"
},
"Logging": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@
<PackageReference Include="System.Drawing.Common" Version="$(SystemDrawingCommon)" />
</ItemGroup>

<ItemGroup>
<Content Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// - WebAppsCallsWebApiCallGraph\\TodoListClient,
// - Navigate to the todo list. this provokes a 401.
// "Authority": "https://localhost:1234/v2.0",
"ClientId": "a4c2469b-cf84-4145-8f5f-cb7bacf814bc", //"712ae8d7-548a-4306-95b6-ee9117ee86f0", JWE clientID
"ClientId": "1e2fb196-50ce-4652-a4f9-26c1bf2e826b", //"712ae8d7-548a-4306-95b6-ee9117ee86f0", JWE clientID
//"ClientSecret": null,
"ClientCertificates": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Instance": "https://login.microsoftonline.com/",
"Domain": "msidentitysamplestesting.onmicrosoft.com",
"TenantId": "7f58f645-c190-4ce5-9de4-e2b7acd2a6ab",
"ClientId": "a4c2469b-cf84-4145-8f5f-cb7bacf814bc",
"ClientId": "1e2fb196-50ce-4652-a4f9-26c1bf2e826b",
"ClientCertificates": [
{
"SourceType": "KeyVault",
Expand Down
2 changes: 1 addition & 1 deletion tests/DevApps/aspnet-mvc/OwinWebApi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Instance": "https://login.microsoftonline.com/",
"Domain": "msidentitysamplestesting.onmicrosoft.com",
"TenantId": "7f58f645-c190-4ce5-9de4-e2b7acd2a6ab",
"ClientId": "a4c2469b-cf84-4145-8f5f-cb7bacf814bc", //"712ae8d7-548a-4306-95b6-ee9117ee86f0", JWE clientID
"ClientId": "1e2fb196-50ce-4652-a4f9-26c1bf2e826b", //"712ae8d7-548a-4306-95b6-ee9117ee86f0", JWE clientID
// "ClientSecret": "",
"Scopes": "access_as_user",
"EnableCacheSynchronization": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:59034",
"sslPort": 44365
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
},
"blazorwasm2-b2c-hosted": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": "true",
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
},
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:49267/",
"sslPort": 44304
}
}
}
}
2 changes: 1 addition & 1 deletion tests/DevApps/blazorwasm2/Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static async Task Main(string[] args)
builder.Services.AddMsalAuthentication(options =>
{
builder.Configuration.Bind("AzureAd", options.ProviderOptions.Authentication);
options.ProviderOptions.DefaultAccessTokenScopes.Add("api://a4c2469b-cf84-4145-8f5f-cb7bacf814bc/access_as_user");
options.ProviderOptions.DefaultAccessTokenScopes.Add("api://1e2fb196-50ce-4652-a4f9-26c1bf2e826b/access_as_user");
});

await builder.Build().RunAsync();
Expand Down
2 changes: 1 addition & 1 deletion tests/DevApps/blazorwasm2/Server/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Instance": "https://login.microsoftonline.com/",
"Domain": "msidentitysamplestesting.onmicrosoft.com",
"TenantId": "7f58f645-c190-4ce5-9de4-e2b7acd2a6ab",
"ClientId": "a4c2469b-cf84-4145-8f5f-cb7bacf814bc",
"ClientId": "1e2fb196-50ce-4652-a4f9-26c1bf2e826b",
"CallbackPath": "/signin-oidc"
},
// },
Expand Down
2 changes: 1 addition & 1 deletion tests/DevApps/daemon-app/Daemon-app/Program-net60.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static async Task Main(string[] args)
// Get the token acquisition service
ITokenAcquirerFactory tokenAcquirerFactory = app.Services.GetRequiredService<ITokenAcquirerFactory>();
var tokenAcquirer = tokenAcquirerFactory.GetTokenAcquirer();
var result = await tokenAcquirer.GetTokenForAppAsync("api://a4c2469b-cf84-4145-8f5f-cb7bacf814bc/.default");
var result = await tokenAcquirer.GetTokenForAppAsync("api://1e2fb196-50ce-4652-a4f9-26c1bf2e826b/.default");
Console.WriteLine($"Token expires on {result.ExpiresOn}");

#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"BaseUrl": "https://localhost:7060/",
"RelativePath": "/WeatherForecast",
"RequestAppToken": true,
"Scopes": [ "api://a4c2469b-cf84-4145-8f5f-cb7bacf814bc/.default" ]
"Scopes": [ "api://1e2fb196-50ce-4652-a4f9-26c1bf2e826b/.default" ]
}
}
2 changes: 1 addition & 1 deletion tests/DevApps/daemon-app/minimal-web-api/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"TenantId": "7f58f645-c190-4ce5-9de4-e2b7acd2a6ab",
"ClientId": "a4c2469b-cf84-4145-8f5f-cb7bacf814bc",
"ClientId": "1e2fb196-50ce-4652-a4f9-26c1bf2e826b",
"Scopes": "Weather.All",
"TokenDecryptionCredentials": [
]
Expand Down
2 changes: 1 addition & 1 deletion tests/E2E Tests/TokenAcquirerTests/TokenAcquirer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ private static async Task CreateGraphClientAndAssert(TokenAcquirerFactory tokenA
.GetAsync(o => o.Options
.WithAppOnly()
.WithAuthenticationScheme(s_optionName));
Assert.True(users!=null && users.Value!=null && users.Value.Count >= 56);
Assert.True(users!=null && users.Value!=null && users.Value.Count >0);

// Alternatively to calling Microsoft Graph, you can get a token acquirer service
// and get a token, and use it in an SDK.
Expand Down
4 changes: 2 additions & 2 deletions tests/E2E Tests/WebAppUiTests/TestingWebAppLocally.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public TestingWebAppLocally(ITestOutputHelper output)
_output = output;
}

[Fact]
[Fact (Skip = "https://github.com/AzureAD/microsoft-identity-web/issues/2716")]
[SupportedOSPlatform("windows")]
public async Task ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPassword()
{
// Arrange
Process? process = null;
const string TraceFileName = TraceFileClassName + "_ValidEmailPassword";
using IPlaywright playwright = await Playwright.CreateAsync();
IBrowser browser = await playwright.Chromium.LaunchAsync(new() { Headless = true });
IBrowser browser = await playwright.Chromium.LaunchAsync(new() { Headless = false });
IBrowserContext context = await browser.NewContextAsync(new BrowserNewContextOptions { IgnoreHTTPSErrors = true });
await context.Tracing.StartAsync(new() { Screenshots = true, Snapshots = true, Sources = true });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public WebAppCallsApiCallsGraphLocally(ITestOutputHelper output)
_output = output;
}

[Fact]
[Fact(Skip = "https://github.com/AzureAD/microsoft-identity-web/issues/2716")]
[SupportedOSPlatform("windows")]
public async Task ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds_TodoAppFunctionsCorrectly()
{
Expand Down

0 comments on commit 4d58560

Please sign in to comment.