gpt4 book ai didi

java - 使用 shiro 的日期相关登录

转载 作者:行者123 更新时间:2023-11-29 04:36:40 26 4
gpt4 key购买 nike

是否可以使用 apache shiro 创建与日期相关的登录?这意味着我将能够指定特定用户只能在特定日期之间对应用程序进行身份验证。

最佳答案

如果不满足日期条件,您可以扩展正在使用的领域并覆盖方法 doGetAuthenticationInfo(AuthenticationToken token):

public class DateRealm extends JdbcRealm {

@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
throws AuthenticationException {
Date date = new Date();
if ( /* Your dat condition here */ true) {
return super.doGetAuthenticationInfo(token);
} else {
return null;
}
}
}

关于java - 使用 shiro 的日期相关登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41140254/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com