springboot整合Shiro鉴权
先写一个自定义的realm类
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.ByteSource;
import java.util.HashSet;
import java.util.Set;
public class MyRealm extends AuthorizingRealm {
//鉴权
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
//登录用户名
String username = (String) principals.getPrimaryPrincipal();
//根据昵称查询数据库中所有权限
//PermMapper List<Permission> list=permMapper.findALl();
SimpleAuthorizationInfo simpleAu