From fc5d24a4f54a57e2e58762e760474fc3effc659e Mon Sep 17 00:00:00 2001 From: Jean-Marc Prieur Date: Wed, 13 Mar 2024 19:40:10 -0700 Subject: [PATCH] Improve the Ciam sample (#2703) Co-authored-by: jennyf19 --- tests/DevApps/ciam/myWebApi/appsettings.json | 5 ++--- tests/DevApps/ciam/myWebApp/Pages/Index.cshtml.cs | 2 +- tests/DevApps/ciam/myWebApp/appsettings.json | 8 +++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/DevApps/ciam/myWebApi/appsettings.json b/tests/DevApps/ciam/myWebApi/appsettings.json index 96cdad92f..7fed354d7 100644 --- a/tests/DevApps/ciam/myWebApi/appsettings.json +++ b/tests/DevApps/ciam/myWebApi/appsettings.json @@ -2,14 +2,13 @@ "AzureAd": { "ClientId": "63e6d091-0e6d-4c8b-be67-d405e02ae3d8", "Scopes": "access_as_user", - "CallbackPath": "/signin-oidc", "Authority": "https://TrialTenantJmprieur.ciamlogin.com/" }, "Logging": { "LogLevel": { - "Default": "Information", + "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "AllowedHosts": "*" -} \ No newline at end of file +} diff --git a/tests/DevApps/ciam/myWebApp/Pages/Index.cshtml.cs b/tests/DevApps/ciam/myWebApp/Pages/Index.cshtml.cs index c59bfa52f..582ac3a9a 100644 --- a/tests/DevApps/ciam/myWebApp/Pages/Index.cshtml.cs +++ b/tests/DevApps/ciam/myWebApp/Pages/Index.cshtml.cs @@ -31,7 +31,7 @@ public async Task OnGet() else { var error = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new HttpRequestException($"Invalid status code in the HttpResponseMessage: {response.StatusCode}: {error}"); + ViewData["ApiResult"] = $"Invalid status code in the HttpResponseMessage: {response.StatusCode}: {error}"; } } } diff --git a/tests/DevApps/ciam/myWebApp/appsettings.json b/tests/DevApps/ciam/myWebApp/appsettings.json index 487b924f6..44871c979 100644 --- a/tests/DevApps/ciam/myWebApp/appsettings.json +++ b/tests/DevApps/ciam/myWebApp/appsettings.json @@ -5,15 +5,17 @@ "ClientCertificates": [], "CallbackPath": "/signin-oidc", "Authority": "https://TrialTenantJmprieur.ciamlogin.com/", + "Prompt": "login" }, "DownstreamApi": { "BaseUrl": "https://localhost:7082/weatherforecast", - "Scopes": "api://63e6d091-0e6d-4c8b-be67-d405e02ae3d8/access_as_user" + "Scopes": [ "api://63e6d091-0e6d-4c8b-be67-d405e02ae3d8/.default" ] }, "Logging": { "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" + "Default": "Information", + "Microsoft.AspNetCore": "Warning", + "Microsoft.Identity": "Information" } }, "AllowedHosts": "*"