cost 222 ms
通過路由在 ASP.Net Core controller 上設置多個全局授權策略?

[英]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 設置 ...

在未授權用戶的自定義身份驗證中顯示 AuthenticateResult.Fail(“Invalid Token Used for Authorisation”)

[英]Display AuthenticateResult.Fail(“Invalid Token Used for Authorisation” ) in custom Authentication for unauthorised user

這是用於自定義身份驗證的 class,但它不會打印錯誤令牌密鑰的消息(令牌密鑰是每個用戶的唯一字符串)=>AuthenticateResult.Fail(“用於授權的令牌無效”)它只是在 postman 中顯示未經授權的 401 狀態代碼。 var valtoken = auth.getT ...

如何在自定義 AuthenticationHandler 中自定義錯誤代碼

[英]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 配置中,我可以聲明一種且只有一種身份驗證類型(模式名稱)。 ...

將自定義 AuthenticationHandler 添加到外部登錄提供程序列表

[英]Adding a custom AuthenticationHandler to a list of external login providers

我使用的是 ASP.NET Core 3.1,並且配置了多個外部登錄提供程序: 我想創建一個自定義AuthenticationProvider ,而不是重定向到另一個網站,而是要求該網站的“API 密鑰”並將其視為訪問令牌。 (有問題的網站不支持任何版本的 OAuth。) 在實際連接之前,我 ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM