[JEP-227] Replace Acegi Security with Spring Security & upgrade Spring Framework (#4848)

Replacing Acegi Security with Spring Security

Co-authored-by: Tim Jacomb <timjacomb1+github@gmail.com>
Co-authored-by: James Nord <jtnord@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2020-11-06 11:30:25 -07:00
1 parent 748e8b2b2d
commit a9ca5ef3d4
229 files changed
+5267 -4111

No files matched your search

+5 -5
View File
@@ -69,7 +69,6 @@ import jenkins.util.io.OnMaster;
import jenkins.util.xml.RestrictiveEntityResolver;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.acegisecurity.Authentication;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
@@ -156,6 +155,7 @@ import java.util.stream.Collectors;
import static hudson.init.InitMilestone.*;
import static java.util.logging.Level.*;
import org.springframework.security.core.Authentication;
/**
* Manages {@link PluginWrapper}s.
@@ -884,7 +884,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
*/
@Restricted(NoExternalUse.class)
public void dynamicLoad(File arc, boolean removeExisting, @CheckForNull List<PluginWrapper> batch) throws IOException, InterruptedException, RestartRequiredException {
try (ACLContext context = ACL.as(ACL.SYSTEM)) {
try (ACLContext context = ACL.as2(ACL.SYSTEM2)) {
LOGGER.log(FINE, "Attempting to dynamic load {0}", arc);
PluginWrapper p = null;
String sn;
@@ -951,7 +951,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
@Restricted(NoExternalUse.class)
public void start(List<PluginWrapper> plugins) throws Exception {
try (ACLContext context = ACL.as(ACL.SYSTEM)) {
try (ACLContext context = ACL.as2(ACL.SYSTEM2)) {
Map<String, PluginWrapper> pluginsByName = plugins.stream().collect(Collectors.toMap(p -> p.getShortName(), p -> p));
// recalculate dependencies of plugins optionally depending the newly deployed ones.
@@ -1548,7 +1548,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
installJobs.add(updateCenter.addJob(updateCenter.new CompleteBatchJob(batch, start, correlationId)));
}
final Authentication currentAuth = Jenkins.getAuthentication();
final Authentication currentAuth = Jenkins.getAuthentication2();
if (!jenkins.getInstallState().isSetupComplete()) {
jenkins.setInstallState(InstallState.INITIAL_PLUGINS_INSTALLING);
@@ -1578,7 +1578,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
}
updateCenter.persistInstallStatus();
if(!failures) {
try (ACLContext acl = ACL.as(currentAuth)) {
try (ACLContext acl = ACL.as2(currentAuth)) {
InstallUtil.proceedToNextStateFrom(InstallState.INITIAL_PLUGINS_INSTALLING);
}
}