简体   繁体   English

使用 GET 进行身份验证时,Servicestack 向我发送错误

[英]Servicestack is sending me an error when using GET for Auth

I am getting an error in the JSON JWT Auth.我在 JSON JWT 身份验证中遇到错误。

GET Authenticate requests are disabled, to enable set AuthFeature.AllowGetAuthenticateRequests=true GET Authenticate 请求被禁用,启用 set AuthFeature.AllowGetAuthenticateRequests=true

This worked a few days ago and I cannot figure out what we changed to break it.这在几天前起作用了,我无法弄清楚我们改变了什么来打破它。 I cannot find this property in the auth feature.我在身份验证功能中找不到此属性。 I even copied the code from the GitHub unit tests.我什至从 GitHub 单元测试中复制了代码。 It does not see there is a property for AllowGetAuthenticateRequests in AuthFeature它没有看到 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,
        });

The AuthFeature.AllowGetAuthenticateRequests property is a lambda, where you can enable all GET Requests with: AuthFeature.AllowGetAuthenticateRequests属性是一个 lambda,您可以在其中启用所有 GET 请求:

Plugins.Add(new AuthFeature(...) {
    AllowGetAuthenticateRequests = req => true
});

If it's not showing up for you then you may have an older pre-release version installed, to install the latest version, clear your NuGet packages cache :如果它没有出现,那么您可能安装了较旧的预发布版本,要安装最新版本,请清除您的 NuGet 包缓存

$ nuget locals all -clear

Then restore your solution again.然后再次恢复您的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM