spring中 shiro logout 配置方式

2021-07-22 05:29:12 字數 1267 閱讀 1286

spring中 shiro logout 配置方式有兩種方式實現logout

1. 普通的action中 實現自己的logout方法,取到subject,然後logout

這種需要在shirofilte***ctorybean 中配置 filterchaindefinitions

對應的action的url為anon

/static/** = anon

/userfiles/** = anon

$/cas = cas

$/login = authc

$/logout = anno

$/** = user

/act/rest/service/editor/** = perms[act:model:edit]

/act/rest/service/model/** = perms[act:model:edit]

/act/rest/service/** = user

/reportserver/** = user

2. 使用shiro提供的logout filter 需要定義 相應的bean

<

對應在 shirofilterchaindefinitions中將對應的url改為logout

/static/** = anon

/userfiles/** = anon

$/cas = cas

$/login = authc

$/logout = logout

$/** = user

/act/rest/service/editor/** = perms[act:model:edit]

/act/rest/service/model/** = perms[act:model:edit]

/act/rest/service/** = user

/reportserver/** = user

並配置loginfilterbean

Spring複習筆記 Spring中的Bean

注意構造器例項化 最常用 靜態工廠方式例項化 例項工廠方式例項化 singleton 單例 始終使用的同乙個物件 預設 prototype 原型 每次都是乙個新的bean例項 request session globalsession websocket init method屬性 用於指定bean...

Spring中 Transactional的使用

1.在需要事務管理的地方加 transactional註解,transactional 註解可以被應用於介面定義和介面方法 類定義和類的 public 方法上.2.transactional 註解只能應用到 public 可見度的方法上,如果你在 protected private 或者 packa...

Spring中 Transactional失效問題

spring中的宣告式註解 transactional很大程度的方便了開發者進行db資料儲存。但是在一些特殊情況下,可能會造成註解不是按想定的方式生效,這裡說幾種可能造成的幾種情況。這是一種比較簡單不過稍不注意也可能會犯的情況。spring中事務提交還是回滾是根據呼叫的方法是否丟擲異常來決定的,因此...