https://github.com/Dreampie/jfinal-shiro 的jfinal-shiro插件: 目前剛剛發(fā)布第一個版本0.1: 首先感謝jfinal-ext中原作者,該插件主要是針對ext插件的部分改進(jìn)。 下面主要介紹兩種使用方式: 在web.xml里添加
啟用shiro 在jfinal config里configPlugin方法添加 添加shiro的過濾器 在jfinal config里configInterceptor方法添加
示例: 前臺使用驗證碼時傳入username,password,captcha 三個參數(shù),第三個是驗證碼參數(shù)名,提前把驗證碼內(nèi)容存入session,shiro會自動進(jìn)行驗證,注意名稱為captcha 主要結(jié)構(gòu)是權(quán)限表里的url-value,如果需要訪問 把這些權(quán)限綁定到角色之后,角色綁定給用戶就相當(dāng)于,用戶下面有很多這些 url-value 1.系統(tǒng)啟動的時候把這個對應(yīng)關(guān)系加載到內(nèi)存或者緩存 //cn.dreampie.shiro.core.ShiroKit 2. 用戶登錄的時候把用戶對應(yīng)的角色所有的權(quán)限加載到緩存,這一步是shiro自己實(shí)現(xiàn) 3.當(dāng)用戶訪問某個url的時候 如訪問/admin/index,過濾器會匹配到/admin/**,這個url需要擁有P_D_ADMIN的權(quán)限 4.然后使用shiro的接口hasPremission(value),判斷用戶是否擁有這個權(quán)限//cn.dreampie.shiro.core.ShiroInterceptor 5.放行或者拒絕訪問返回403狀態(tài) jfinal-shiro支持Ajax登陸/退出,使用json數(shù)據(jù) 如果你使用freemarker作為模板,推薦使用jfinal-shiro-freemarker標(biāo)簽庫 http://my.oschina.net/wangrenhui1990/blog/312741 https://github.com/Dreampie?tab=repositories 目錄下有多款插件: cn.dreampie.jfinal-shiro https://github.com/Dreampie/jfinal-shiro shiro插件 cn.dreampie.jfinal-shiro-freemarker https://github.com/Dreampie/jfinal-shiro-freemarker shiro插件實(shí)現(xiàn)的freemarker標(biāo)簽庫 cn.dreampie.jfinal-web https://github.com/Dreampie/jfinal-web 相關(guān)web插件,簡潔model實(shí)現(xiàn) cn.dreampie.jfinal-utils https://github.com/Dreampie/jfinal-utils 部分jfinal工具 cn.dreampie.jfinal-tablebind https://github.com/Dreampie/jfinal-tablebind jfinal的table自動綁定插件,支持多數(shù)據(jù)源 cn.dreampie.jfinal-flyway https://github.com/Dreampie/jfinal-flyway 數(shù)據(jù)庫腳本升級插件,開發(fā)中升級應(yīng)用時,使用腳本同步升級數(shù)據(jù)庫或者回滾 cn.dreampie.jfinal-captcha https://github.com/Dreampie/jfinal-captcha 基于jfinal render的超簡單驗證嗎插件 cn.dreampie.jfinal-quartz https://github.com/Dreampie/jfinal-quartz 基于jfinal 的quartz管理器 cn.dreampie.jfinal-sqlinxml https://github.com/Dreampie/jfinal-sqlinxml 基于jfinal 的類似ibatis的sql語句管理方案 cn.dreampie.jfinal-lesscss https://github.com/Dreampie/jfinal-lesscss java實(shí)現(xiàn)的lesscsss實(shí)時編譯插件,可以由于jfinal cn.dreampie.jfinal-coffeescript https://github.com/Dreampie/jfinal-coffeescript java實(shí)現(xiàn)的coffeescript實(shí)時編譯插件,可以由于jfinal cn.dreampie.jfinal-akka https://github.com/Dreampie/jfinal-akka java使用akka執(zhí)行異步任務(wù) cn.dreampie.jfinal-mailer https://github.com/Dreampie/jfinal-mailer 使用akka發(fā)布郵件的jfinal插件 cn.dreampie.jfinal-slf4j https://github.com/Dreampie/jfinal-slf4j 讓jfinal使用slf4j的日志api 部分內(nèi)容借鑒了網(wǎng)絡(luò)資料 評論7
|
|