![](/img/trans.png)
[英]Why is authentication working with EndPoints, but not with MapWhen?
我將 BasicAuthentication 添加到 WebApplication。 我使用了這個教程: https://www.roundthecode.com/dotnet/how-to-add-basic-authentication-to-asp-net-core-application ...
[英]Why is authentication working with EndPoints, but not with MapWhen?
我將 BasicAuthentication 添加到 WebApplication。 我使用了這個教程: https://www.roundthecode.com/dotnet/how-to-add-basic-authentication-to-asp-net-core-application ...
[英]Scheme already exists: Bearer
我正在使用 Microsoft 提供程序實現登錄,還使用 jwt 實現默認登錄當我運行項目時出現此錯誤(方案已存在:Bearer) 當我評論這部分時,項目成功運行 這是我的代碼 ...
[英]Setting multiple global authorization policies on ASP.Net Core controller by route?
使用 ASP.Net Core API。 常規應用程序有一個路由 (api/ ),管理 api 的另一個路由 (admin/ )。 有沒有辦法根據 URL 設置不同的全局策略? 這篇文章使用 ASP.NET Core 3.x 中的 DefaultPolicy 和 FallbackPolicy 設置 ...
[英]Dynamically chose authentication scheme in ASP.net Core Wep Api
I am porting a self-hosted web API built using OWIN and the .NET Framework to a ASP.NET Core Web API (using .NET 6.0) 在原始的 API 中,我有一個自定義身份驗證機制,它根據請求中 ...
[英]Display AuthenticateResult.Fail(“Invalid Token Used for Authorisation” ) in custom Authentication for unauthorised user
這是用於自定義身份驗證的 class,但它不會打印錯誤令牌密鑰的消息(令牌密鑰是每個用戶的唯一字符串)=>AuthenticateResult.Fail(“用於授權的令牌無效”)它只是在 postman 中顯示未經授權的 401 狀態代碼。 var valtoken = auth.getT ...
[英]How to customize error code in custom AuthenticationHandler
有一個名為CustomAuthenticationHandler的自定義 AuthenticationHandler ,其默認錯誤代碼為 401。但我必須在不同條件下以不同的錯誤代碼和錯誤消息進行響應。 如果請求在某些情況下應響應 403,當前解決方案如下所示: public class Cust ...
[英]How to merge multiple authentication schema in one (Custom Authentication)
我在我的 .NET Core API 中使用add multiple Jwt bearer進行了多次身份驗證,假設我有Schema1 、 Schema2和Schema3 。 我也在使用Ocelot來管理請求。 在每條路線的 Ocelot 配置中,我可以聲明一種且只有一種身份驗證類型(模式名稱)。 ...
[英]Adding a custom AuthenticationHandler to a list of external login providers
我使用的是 ASP.NET Core 3.1,並且配置了多個外部登錄提供程序: 我想創建一個自定義AuthenticationProvider ,而不是重定向到另一個網站,而是要求該網站的“API 密鑰”並將其視為訪問令牌。 (有問題的網站不支持任何版本的 OAuth。) 在實際連接之前,我 ...
[英]Unit Test Custom AuthenticationHandler Middleware
如何對繼承自AuthenticationHandler<AuthenticationSchemeOptions>的自定義中間件進行單元測試? 我從它繼承的自定義 class 用於基本身份驗證。 ...