1 Star 0 Fork 953

韵律浮尘/jboot

forked from JbootProjects/jboot 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ShiroController.java 1.21 KB
一键复制 编辑 原始数据 按行查看 历史
Michael Yang 提交于 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/JavaLead/jboot.git
git@gitee.com:JavaLead/jboot.git
JavaLead
jboot
jboot
master

搜索帮助