asp.net-core-3.1

Change redirectURI and CallbackPath for AzureAD authentication in .net core 3.1.1 web app

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-02 10:00:42
问题 I created a new .net core 3.1.1 web application with the Razor Pages framework. When creating the app I set up the default Authentication as AzureAd. When I run the application the authentication works just fine. The generated appsettings file looks like this: { "AzureAd": { "Instance": "https://login.microsoftonline.com/", "Domain": "myDomain", "TenantId": "myTenantId", "ClientId": "myClientId", "CallbackPath": "/signin-oidc" }, "Logging": { "LogLevel": { "Default": "Information", "Microsoft

Change redirectURI and CallbackPath for AzureAD authentication in .net core 3.1.1 web app

淺唱寂寞╮ 提交于 2021-02-02 09:57:26
问题 I created a new .net core 3.1.1 web application with the Razor Pages framework. When creating the app I set up the default Authentication as AzureAd. When I run the application the authentication works just fine. The generated appsettings file looks like this: { "AzureAd": { "Instance": "https://login.microsoftonline.com/", "Domain": "myDomain", "TenantId": "myTenantId", "ClientId": "myClientId", "CallbackPath": "/signin-oidc" }, "Logging": { "LogLevel": { "Default": "Information", "Microsoft

Blazor WebAssembly with index file configuration logic causing AmbiguousMatchException

点点圈 提交于 2021-01-29 18:36:40
问题 I am creating a Blazor WASM and I need to include logic within the index.html file to load different css/js files and apply various css styles to body tag based on some conditions. However since the root file is static (www/index.html) and the app tag is nested inside the body tag this is not possible. So I followed this link and created an Index.cshtml file (based on the static index file) in the server project and changed the endpoint in the Startup of the server project to

Is there a way to Authorize Net Core 3.0 APIs with JWT and also Azure AD Tokens

╄→гoц情女王★ 提交于 2021-01-29 15:27:20
问题 I'm creating a web service that contains authentication (no identity), and I protected the APIS with JWT (the token is returned when the user logs in or registers by email, password, name, etc..) but I also have a microsoft login/register using MSAL, I also created an Azure App. How do I validate the login with microsoft to return the JWT or how could I implement the API authorization using both JWT and Azure AD. 回答1: You have currently registered an Azure application, you can set it as a

Azure AD Multi Tenant ,.Net Core Web API with MSAL(Microsoft Authentication Libary)

非 Y 不嫁゛ 提交于 2021-01-29 09:45:36
问题 I believe I have the Microsoft Authentication Library (MSAL) JavaScript pulling back a JWT token, using azure AD multi tenant with the following config. Based of this link https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-convert-app-to-be-multi-tenant. I believe I only need the following two values. clientId: "A134d6c8-8078-2924-9e90-98cef862eb9a" // this would be the app registrations client id(application) authority: "https://login.microsoftonline.com/common" How then

How to intercept messages in Bot Framework v4 for logging, using C# Core 3.1

£可爱£侵袭症+ 提交于 2021-01-29 06:04:48
问题 We found this documentation explaining how to intercept messages in bot framework v3: https://docs.microsoft.com/en-us/azure/bot-service/dotnet/bot-builder-dotnet-middleware?view=azure-bot-service-3.0 We want to do exactly that, only in v4 of the bot framework. We could not find documentation for intercepting messages for bot framework v4 here: https://docs.microsoft.com/en-us/azure/bot-service/?view=azure-bot-service-4.0 Is there a way to intercept the messages in bot framework v4, so we can

How to unit test a function in .NET Core 3.1 that uses ExecuteSqlRawAsync to call a stored procedure?

南笙酒味 提交于 2021-01-29 06:02:11
问题 I'm writing an API in ASP.NET Core 3.1, using EF Core to access a SQL Server database. I have a function in the API that needs to call a stored procedure with several input parameters and an output parameter. A simplified version of this function is below. I am using a DbContext with .UseInMemoryDatabase() for other tests, but the in memory database cannot be used with stored procedures. (This solution is database first, not code first. It would be possible to change the stored procedure if

ASP.NET Core 3.1 - From a Hosted Service, check if client (Index) page is loaded

扶醉桌前 提交于 2021-01-29 05:50:46
问题 I have a simple 1-page web app using the VS2019 Razor Pages template. The hosted service will send data to the page via SignalR. Is it possible to check if the client page (Index page) is loaded because if not then the hosted service will pause sending data? When running from VS2019 the page of course opens automatically but running from "dotnet run" I need to know if the user has loaded the page into the browser e.g. they might shut it down after the service has started. namespace

ASP.NET Core 3.1 - From a Hosted Service, check if client (Index) page is loaded

风流意气都作罢 提交于 2021-01-29 05:49:38
问题 I have a simple 1-page web app using the VS2019 Razor Pages template. The hosted service will send data to the page via SignalR. Is it possible to check if the client page (Index page) is loaded because if not then the hosted service will pause sending data? When running from VS2019 the page of course opens automatically but running from "dotnet run" I need to know if the user has loaded the page into the browser e.g. they might shut it down after the service has started. namespace

StatusCodePagesMiddleware doesn't intercept exceptions?

天涯浪子 提交于 2021-01-28 06:11:50
问题 For example, in the Index page: public ActionResult OnGet() { //return StatusCode(500); throw new Exception(); } My Startup configuration: public void Configure(IApplicationBuilder app) { //app.UseStatusCodePagesWithReExecute("/Error", "?statusCode={0}"); app.UseStatusCodePages(); app.UseStaticFiles(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); }); } When the Index.OnGet() gets executed and throws the exception, the default 500 page of the browser is shown