1 Star 0 Fork 953

jlcoding/jboot

forked from JbootProjects/jboot 
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
ShiroController.java 1.21 KB
Copy Edit Raw Blame History
Michael Yang authored 2018-04-24 18:28 +08:00 . update shiro test
package shiro;
import io.jboot.web.controller.JbootController;
import io.jboot.web.controller.annotation.RequestMapping;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresGuest;
import org.apache.shiro.subject.Subject;
/**
* @author Michael Yang 杨福海 (fuhai999@gmail.com)
* @version V1.0
* @Package shiro
*/
@RequestMapping(value = "/shiro",viewPath = "/htmls/shiro")
public class ShiroController extends JbootController {
public void index() {
render("index.html");
}
public void login(){
Subject subject = SecurityUtils.getSubject();
subject.login(new MyAuthenticationToken());
// subject.isAuthenticated();
// subject.isPermitted()
renderText("logined");
}
public void doLogin(){
renderText("doLogin");
}
public void logout(){
Subject subject = SecurityUtils.getSubject();
subject.logout();
renderText("logouted");
}
@RequiresAuthentication
public void usercenter(){
renderText("usercenter");
}
@RequiresGuest
public void guest(){
renderText("guest");
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/msgcode/jboot.git
git@gitee.com:msgcode/jboot.git
msgcode
jboot
jboot
master

Search