我想跟踪失败的登录尝试,以便进行安全审计。
我看到有一个BeforeLogin触发器,但只有在成功登录时才会被调用。
当然,我可以通过网站的登录页面检测到登录失败,并调用云函数记录登录失败。但是如果有黑客绕过我的网站,直接向我的服务器发送登录请求,我是不会发现的。
有没有一个触发器,是针对登录失败的,还是针对所有登录的? 或者有其他方法可以做到这一点?
你可以使用 accountLockout
选项。
例如
accountLockout: {
threshold: 3, //threshold policy setting determines the number of failed sign-in attempts that will cause a user account to be locked. Set it to an integer value greater than 0 and less than 1000
duration: 5 // duration policy setting determines the number of minutes that a locked-out account remains locked out before automatically becoming unlocked. Set it to a value greater than 0 and less than 100000.
}
关于这个参数和其他解析参数的更多信息可以在这里找到。
https:/docs.parseplatform.orgparse-serverguide#welcome-emails-and-email-verification。
和这里。
https:/parseplatform.orgparse-serverapimasterParseServerOptions.html。