Login interception of Shiro: shrio

problem description

the project used to be developed using jeesite, but now I want to rewrite the project, but the old code and methods can"t be removed. Now Vue, is used at the front end, but when logging in, it will not enter the interceptor of shiro, but will directly return a redirect request. Vue will naturally report an error. I would like to ask how the current URL should be written, or how should shiro be configured, so that

can be made.

the environmental background of the problems and what methods you have tried

I have tried to log in directly using subject.login (token) and log in successfully (subject.getPrincipal () is not empty in the login method), but when I enter another method again, the return value of the subject.getPrincipal () method is null

related codes

/ / Please paste the code text below (do not replace the code with pictures)
original login URL
/ a/login

vue background login method
@ RequestMapping (value = "/ sys/login", method = RequestMethod.POST)
public ResultVo userLogin (User user,HttpServletRequest request,HttpServletResponse response) {

    ResultVo pass = ApiResponseUtil.pass();
    Subject subject = SecurityUtils.getSubject();
    try {
        UsernamePasswordToken token = new UsernamePasswordToken(user.getLoginName(),user.getPassword().toCharArray(),false,"","",false);
        subject.login(token);
    }catch (Exception e){
        e.printStackTrace();
        return ApiResponseUtil.unknowProblem(e);
    }
    if(subject.isAuthenticated()){
        SystemAuthorizingRealm.Principal principal = (SystemAuthorizingRealm.Principal)subject.getPrincipal();
        pass.setResult(principal);
        return pass;
    }else{
        return ApiResponseUtil.fieldInvalid("","");
    }
}

vue foreground login method
function login (env, cb) {

    return env.$http({
        method: "post",
        url: env.config.tam + "/rest/sys/login",
        data: {
            username: env.login.loginName,
            password: env.login.password,
        },
        withCredentials: true,
    }).then((resp) => {
        var data = resp.data
        if (data.code == 0) {
            console.log(data.result)
            env.$cookies.set("sessionid",data.result.sessionid)
            env.$cookies.set("loginName",data.result.loginName)
            return env.$router.push({path: "/tam/manager/list"})
        }
        else if (data.code == -6) {
            return sendMail.apply(this, [env])
        } else if (data.code == -5) {
            throw{
                type: "warning",
                message: ""
            }fangfa
        } else if (data.code == -8) {
            env.displayValidateCode = true
            env.$cookies.set("displayValidateCode", true, 5 * 30)
            throw{
                type: "warning",
                message: data.message

what result do you expect? What is the error message actually seen?

Sep.02,2021
Menu