No need init password when auth disabled. (#12153)

This commit is contained in:
杨翊 SionYang 2024-05-31 09:24:21 +08:00 committed by GitHub
parent 47786e6c0b
commit 857e6113c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -113,9 +113,16 @@ public class NacosAuthPluginService implements AuthPluginService {
return ApplicationUtils.getBean(AuthConfigs.class).isAuthEnabled();
}
/**
* Only auth enabled and not global admin role existed.
*
* @return {@code true} when auth enabled and not global admin role existed, otherwise {@code false}
*/
@Override
public boolean isAdminRequest() {
return !ApplicationUtils.getBean(IAuthenticationManager.class).hasGlobalAdminRole();
boolean authEnabled = ApplicationUtils.getBean(AuthConfigs.class).isAuthEnabled();
boolean hasGlobalAdminRole = ApplicationUtils.getBean(IAuthenticationManager.class).hasGlobalAdminRole();
return authEnabled && !hasGlobalAdminRole;
}
protected void checkNacosAuthManager() {