refactor: 修改类名

This commit is contained in:
Captain.B 2021-03-19 13:58:21 +08:00
parent 37abc8efd8
commit 6251fa18c7
4 changed files with 10 additions and 10 deletions

View File

@ -5,7 +5,7 @@ import io.metersphere.security.ApiKeyFilter;
import io.metersphere.security.CsrfFilter;
import io.metersphere.security.UserModularRealmAuthenticator;
import io.metersphere.security.realm.LdapRealm;
import io.metersphere.security.realm.ShiroDBRealm;
import io.metersphere.security.realm.LocalRealm;
import org.apache.shiro.authc.pam.FirstSuccessfulStrategy;
import org.apache.shiro.authc.pam.ModularRealmAuthenticator;
import org.apache.shiro.cache.MemoryConstrainedCacheManager;
@ -70,7 +70,7 @@ public class ShiroConfig implements EnvironmentAware {
}
/**
* securityManager 不用直接注入shiroDBRealm可能会导致事务失效
* securityManager 不用直接注入 Realm可能会导致事务失效
* 解决方法见 handleContextRefresh
* http://www.debugrun.com/a/NKS9EJQ.html
*/
@ -85,8 +85,8 @@ public class ShiroConfig implements EnvironmentAware {
@Bean
@DependsOn("lifecycleBeanPostProcessor")
public ShiroDBRealm shiroDBRealm() {
return new ShiroDBRealm();
public LocalRealm localRealm() {
return new LocalRealm();
}
@Bean
@ -135,10 +135,10 @@ public class ShiroConfig implements EnvironmentAware {
public void handleContextRefresh(ContextRefreshedEvent event) {
ApplicationContext context = event.getApplicationContext();
List<Realm> realmList = new ArrayList<>();
ShiroDBRealm shiroDBRealm = context.getBean(ShiroDBRealm.class);
LocalRealm localRealm = context.getBean(LocalRealm.class);
LdapRealm ldapRealm = context.getBean(LdapRealm.class);
// 基本realm
realmList.add(shiroDBRealm);
realmList.add(localRealm);
realmList.add(ldapRealm);
context.getBean(DefaultWebSecurityManager.class).setRealms(realmList);
}

View File

@ -68,7 +68,7 @@ public class LdapController {
userService.addLdapUser(user);
}
// 执行 ShiroDBRealm LDAP 登录逻辑
// 执行 LocalRealm LDAP 登录逻辑
LoginRequest loginRequest = new LoginRequest();
loginRequest.setUsername(userId);
return userService.login(loginRequest);

View File

@ -34,9 +34,9 @@ import java.util.stream.Collectors;
* set realm
* </p>
*/
public class ShiroDBRealm extends AuthorizingRealm {
public class LocalRealm extends AuthorizingRealm {
private Logger logger = LoggerFactory.getLogger(ShiroDBRealm.class);
private Logger logger = LoggerFactory.getLogger(LocalRealm.class);
@Resource
private UserService userService;

@ -1 +1 @@
Subproject commit 245845e07bf3fe2f60311eeb78f8f109301a2d39
Subproject commit 6806c68338543cf1d04bb25dc24201dd1949e111