当前在auth/login中,您可以使用任何Get。如何限制某些内置服务的 GET 关键字。我们有一个渗透测试结果表明,不应通过 Get 关键字允许身份验证/登录,而只能通过 put 或 post 进行。
如果您指的是 HTTP GET 请求,您可以注册一个全局请求过滤器 http://docs.servicestack.net/request-and-response-filters使短路Authenticate
HTTP GET 请求:
GlobalRequestFilters.Add((req, res, requestDto) => {
if (requestDto is Authenticate auth && req.Verb == HttpMethods.Get)
{
res.StatusCode = (int)HttpStatusCode.MethodNotAllowed;
res.EndRequest();
}
});
我还禁用了 GETAuthenticate
默认请求(对于非 OAuth 提供商)这次提交 https://github.com/ServiceStack/ServiceStack/commit/64d65b5b8a0c680d9f4a083b3186a7a5b6d1521a从 v5.4.1+ 开始可在 MyGet 上找到 https://docs.servicestack.net/myget,可以通过以下方式重新启用:
Plugins.Add(new AuthFeature(...) {
AllowGetAuthenticateRequests = req => true
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)