Subject.login设计的类和方法
- Controller中我们使用subject.login(token)来执行登陆操作
- DelegatingSubject.login中使用securityManager.login(this.token)
- DefaultSecrityManager(这里我注入的是这个secrityManager,也可以自定义).login中使用authenticate(token)
- AuthenticatingSecurityManager.authenticate中使用authenticator.authenticate(token)
- AbstractAuthenticator.authenticate中使用doAuthenticate(token)
- ModularRealmAuthenticator.doAuthenticate中通过getRealms来得到所有的Realm,然后使用(我假设这里只定义了一个realm)doSingleRealmAuthentication(realm, authenticationtoekn)
- ModularReamlmAuthenticator.doSingleRealmAuthentication中使用了Realm.getAuthenticationInfo(token)
- AUthenticatingRealm中使用doGetAuthenticatingInfor(token),这个方法其实就是我们自定的Realm中的方法,而后使用assertCredentialsMatch(token,info)
- 自定义或者默认的CredentialMatcher的doCredentialsMatch方法对info中的Credential和token中的crediential进行比对
以上就是login涉及到的过程 ,后续自定义其中的类可以进行参阅