什麼是認證?
身份認證,校驗使用者是否有相應的身份(登入驗證)
Shiro實現認證的具體流程:
大致上來說是:
graph LR
Subject-->SecurityManager
SecurityManager-->Authenticator
Authenticator-->Realm
Realm-->Cryptography加密
複製程式碼

首先,使用者填寫登入資訊傳送請求到action中,action中呼叫subject中的login方法.

然後由於Subject物件是一個介面,因此我們查詢它的實現類

DelegattingSubject是Subject的實現類

然而它又由securityManager 來呼叫

SecurityManager是一個介面,繼續找它的實現類

認證安全管理

類中的這個方法繼續將我們頁面中封裝好的token傳遞



最後這個token傳到了ModularRealmAuthenticator這裡來了.這裡面的doSingleRealmAuthentication呼叫了我們自定義的Realm.並把我們在Action中封裝的Token傳遞進Realm中進行認證校驗.
