qq_迷途小书童_3
2018-12-24 14:35
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); } }
我这么写 有问题么,但是 编译过后,后台出现问题
能帮我解决一下么
Shiro安全框架入门
48036 学习 · 332 问题
相似问题