Shiro自定义Realm(二)
项目结构: 1 :自定义 reaml ,继承 AuthorizingRealm 重写 3 方法:getName doGetAuthorizationInfo doGetAuthenticationInfo public class MyRealm extends AuthorizingRealm { public String getName(){ return "MyRealm"; } //授权操作 @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { return null; } //认证操作 @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { //参数token:表示登陆时保证的UsernamePasswordToken //通过用户名到数据库中查用户信息,封装成一个AuthenticationInfo认证对象返回,方便认证器进行对比 String username =(String)