一 . 繼承org.apache.shiro.realm.activedirectory.ActiveDirectoryRealm
public class ShiroRealm extends AuthorizingRealm {
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
方法...
}
}
二 . 重寫protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token);方法
public class ShiroRealm extends AuthorizingRealm {
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
......
SimpleAuthenticationInfo info = SimpleAuthenticationInfo(
Object principal, //認(rèn)證的實(shí)體信息. 可以是 username, 也可以是數(shù)據(jù)表對應(yīng)的用戶的實(shí)體類對象.
Object hashedCredentials, //密碼
ByteSource credentialsSalt, //當(dāng)前 realm 對象的 name. 調(diào)用父類的 getName() 方法即可 (getName();)
String realmName //ByteSource.Util.bytes(username);
);
......
三 . Spring 配置 bean
----未完待續(xù)