SpringBoot启动类如下:
package com.mmall.demo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan
@MapperScan(basePackages = {"com.mmall.demo.mapper"})
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
自定义密码校验规则CredentialMatcher(登录输入的密码与数据库匹配即可)
package com.mmall.demo;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;
/**
* 自定义密码校验规则
* @author lenovo
*
*/
public class CredentialMatcher extends SimpleCredentialsMatcher{
@Override