![](/img/trans.png)
[英]ServiceStack - Access to the request DTO when using the built-in auth feature?
[英]Servicestack is sending me an error when using GET for Auth
我在 JSON JWT 身份驗證中遇到錯誤。
GET Authenticate 請求被禁用,啟用 set AuthFeature.AllowGetAuthenticateRequests=true
這在幾天前起作用了,我無法弄清楚我們改變了什么來打破它。 我在身份驗證功能中找不到此屬性。 我什至從 GitHub 單元測試中復制了代碼。 它沒有看到 AuthFeature 中有 AllowGetAuthenticateRequests 的屬性
Plugins.Add(new AuthFeature(() => new CustomUserSession(),
new IAuthProvider[]
{
new BasicAuthProvider(), //Sign-in with HTTP Basic Auth
new JwtAuthProvider(AppSettings) {
//HashAlgorithm = "HM256",
//PrivateKey = privateKey.ExportParameters(true),
AuthKeyBase64 = AppSettings.GetString("jwt.auth.key"),
RequireSecureConnection = false,
//Turn on for Prod: EncryptPayload = true
}, //JWT TOKENS
new CredentialsAuthProvider(AppSettings)
})
{
HtmlRedirect = "/",
//IncludeRegistrationService = true,
});
AuthFeature.AllowGetAuthenticateRequests屬性是一個 lambda,您可以在其中啟用所有 GET 請求:
Plugins.Add(new AuthFeature(...) {
AllowGetAuthenticateRequests = req => true
});
如果它沒有出現,那么您可能安裝了較舊的預發布版本,要安裝最新版本,請清除您的 NuGet 包緩存:
$ nuget locals all -clear
然后再次恢復您的解決方案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.