shiro 認證配置和認證過程理解

2021-07-22 15:03:54 字數 661 閱讀 7356

/mydemo/login=authc

/main**=authc

/user/info**=authc

/admin/listuser**=authc,perms[admin:manage]

在上面我定義了/mydemo/login=authc,表示想要訪問/mydemo/login那麼你就需要認證先,就是登陸的意思,所以重定向/login.jsp

2、當我們呼叫subject.login("df","12")時,進入securitymanager呼叫認證器,認證器根據認證策略呼叫realm,如果自定義reaml,例如:

public class passwordtestrealm extends authorizingrealm

//認證方法

@override

protected authenticationinfo dogetauthenticationinfo(

authenticationtoken token) throws authenticationexception

}

那麼就呼叫上面的認證的方法,之後返回乙個物件之後還會預設去呼叫一些方法去比較兩個密碼的正確性

Shiro認證過程

應用程式 呼叫 subject.login 方法,傳遞建立好的包含終端使用者的 principals 身份 和 credentials 憑證 的 authenticationtoken 例項 subject 例項 通常為 delegatingsubject 或子類 委託應用程式的 securitym...

Shiro認證過程?

應用程式 呼叫 subject。login 方法,傳遞建立好的包含終端使用者的 principals 身份 和 credentials 憑證 的 authenticationtoken 例項 subject 例項 通常為 delegatingsubject 或子類 委託應用程式的 securitym...

Shiro認證過程?

應用程式 呼叫 subject。login 方法,傳遞建立好的包含終端使用者的 principals 身份 和 credentials 憑證 的 authenticationtoken 例項 subject 例項 通常為 delegatingsubject 或子類 委託應用程式的 securitym...