?!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 亚洲精品国产高清一线久久,亚洲va欧美va国产va综合,玩弄放荡人妻少妇系列

亚洲精品92内射,午夜福利院在线观看免费 ,亚洲av中文无码乱人伦在线视色,亚洲国产欧美国产综合在线,亚洲国产精品综合久久2007

?div class="header_top">
Java知识分n|?- L学习(fn)从此开始! (tng) (tng) (tng) (tng)
SpringBoot+SpringSecurity+Vue+ElementPlus权限pȝ实战评 震撼发布        

最新Java全栈׃实战评(免费)

springcloud分布式电(sh)商秒杀实战评

IDEA怹Ȁz?/h2>

66套java实战评无套路领?/h2>

锋哥开始收Java学员啦!

Python学习(fn)路线?/h2>

锋哥开始收Java学员啦!

安全框架Shiro使用 PDF 下蝲


旉:2020-08-24 07:56来源:http://www.sh6999.cn 作?锋  侉|举报
安全框架Shiro使用 PDF 下蝲
失效链接处理
安全框架Shiro使用 PDF 下蝲


本站整理下蝲Q?/strong>
链接Q?a target="_blank">https://pan.baidu.com/s/1BPX2FOFZfq5mIlg7Ec9Lbw 
提取码:(x)uk3i
 
相关截图Q?/strong>
 
主要内容Q?/strong>

1.参考网址Q?/div>
https://www.w3cschool.cn/shiro/co4m1if2.html
 
2.Shiro的简介与核心(j)对象介绍
2.1.Shiro中的核心(j)模块
2.2.Shiro的架?/div>
2.3.Shiro的核?j)对?cd对象)
3.认证
3.1.Realm
3.1.1.SimpleAccountRealm
package com.shiro.authc;
 
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.mgt.DefaultSecurityManager;
import org.apache.shiro.realm.SimpleAccountRealm;
import org.apache.shiro.subject.Subject;
 
public class Realm_Simple {
 
public static void main(String[] args) {
SimpleAccountRealm realm = new SimpleAccountRealm();
realm.addAccount("admin", "123");
realm.addAccount("guest", "456");
realm.addAccount("test", "789");
 
//1、实例化SecurityManagert和对应的Realm数据?/div>
DefaultSecurityManager securityManager = new DefaultSecurityManager();
//注入一个Realm
securityManager.setRealm(realm);
 
//2、获取Subject对象
SecurityUtils.setSecurityManager(securityManager);
Subject subject = SecurityUtils.getSubject();
 
//3、程序提交用户名和密码交lShiro来进行判断?/div>
String username = "admin";
String password = "123";
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
try {
subject.login(token);
 
System.out.println("认证成功");
System.out.println("认证后的w䆾信息 = " + subject.getPrincipal());
 
} catch (org.apache.shiro.authc.UnknownAccountException e) {
System.out.println("用户名不存在的异?quot;);
} catch (org.apache.shiro.authc.IncorrectCredentialsException e) {
System.out.println("密码不正?quot;);
}
}
}
 
 
3.1.2.IniRealm
3.1.2.1.Shiro-config.ini
[main]
authenticator=org.apache.shiro.authc.pam.ModularRealmAuthenticator
authenticationStrategy=org.apache.shiro.authc.pam.AtLeastOneSuccessfulStrategy
authenticator.authenticationStrategy=$authenticationStrategy
securityManager.authenticator=$authenticator
 
authorizer=org.apache.shiro.authz.ModularRealmAuthorizer
permissionResolver=org.apache.shiro.authz.permission.WildcardPermissionResolver
authorizer.permissionResolver=$permissionResolver
securityManager.authorizer=$authorizer
 
[users]
admin=123
guest=456
test=789
[roles]
[urls]
 
 
package com.shiro.authc;
 
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.config.IniSecurityManagerFactory;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.util.Factory;
 
public class Realm_Ini {
public static void main(String[] args) {
//1、创Z个shiro的配|文Ӟq且dINI文g
Factory<org.apache.shiro.mgt.SecurityManager> factory = new IniSecurityManagerFactory("classpath:shiro-config.ini");
org.apache.shiro.mgt.SecurityManager securityManager = factory.getInstance();
 
//2、获取Subject对象
SecurityUtils.setSecurityManager(securityManager);
Subject subject = SecurityUtils.getSubject();
 
//3、程序提交用户名和密码交lShiro来进行判断?/div>
String username = "admin";
String password = "123";
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
try {
subject.login(token);
 
System.out.println("认证成功");
System.out.println("认证后的w䆾信息 = " + subject.getPrincipal());
 
System.out.println("是否通过认证 = " + subject.isAuthenticated());
 
} catch (org.apache.shiro.authc.UnknownAccountException e) {
System.out.println("用户名不存在的异?quot;);
} catch (org.apache.shiro.authc.IncorrectCredentialsException e) {
System.out.println("密码不正?quot;);
}
}
}

 

------分隔U?---------------------------
?!-- //底部模板 -->