public class ShiroTest { SimpleAccountRealm simpleAccountRealm =new SimpleAccountRealm(); @Before public void addUser(){ simpleAccountRealm.addAccount("mark","123456"); } @Test public void testAuthentication(){ //构建SecurityManager环境 DefaultSecurityManager defaultSecurityManager =new DefaultSecurityManager(); defaultSecurityManager.setRealm(simpleAccountRealm); //主动提交认证请求 SecurityUtils.setSecurityManager(defaultSecurityManager); Subject subject = SecurityUtils.getSubject(); UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken("mark","123456"); subject.login(usernamePasswordToken); } }
我这么写 有问题么,但是 编译过后,后台出现问题
能帮我解决一下么