Skip to content

Commit

Permalink
增加 shiro 的代码
Browse files Browse the repository at this point in the history
  • Loading branch information
YunaiV committed Dec 18, 2019
1 parent fb6c5fb commit 66ec3e1
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ public class ShiroConfig {

@Bean
public Realm realm() {
// 创建 SimpleAccountRealm 对象
SimpleAccountRealm realm = new SimpleAccountRealm();
// 添加两个用户。参数分别是 username、password、roles 。
realm.addAccount("admin", "admin", "ADMIN");
realm.addAccount("normal", "normal", "NORMAL");
return realm;
}

@Bean
public DefaultWebSecurityManager securityManager() {
// 创建 DefaultWebSecurityManager 对象
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
// 设置其使用的 Realm
securityManager.setRealm(this.realm());
return securityManager;
}
Expand Down

0 comments on commit 66ec3e1

Please sign in to comment.