Source:
public SetupWizard(Jenkins j) throws IOException { User admin; if(j.getSecurityRealm() == null || j.getSecurityRealm() == SecurityRealm.NO_AUTHENTICATION) { BulkChange bc = new BulkChange(j); HudsonPrivateSecurityRealm securityRealm = new HudsonPrivateSecurityRealm(false, false, null); j.setSecurityRealm(securityRealm); String randomUUID = System.getProperty("jenkins.install.initialAdminPassword", UUID.randomUUID().toString().replace("-", "").toLowerCase(Locale.ENGLISH)); admin = securityRealm.createAccount(SetupWizard.initialSetupAdminUserName, randomUUID); admin.addProperty(new SetupWizard.AuthenticationKey(randomUUID)); FullControlOnceLoggedInAuthorizationStrategy authStrategy = new FullControlOnceLoggedInAuthorizationStrategy(); authStrategy.setAllowAnonymousRead(false); j.setAuthorizationStrategy(authStrategy); j.setSlaveAgentPort(-1); j.setCrumbIssuer(new DefaultCrumbIssuer(false)); j.getInjector().getInstance(AdminWhitelistRule.class) .setMasterKillSwitch(false); try{ j.save(); } finally { bc.commit(); } } else { admin = j.getUser(SetupWizard.initialSetupAdminUserName); } String setupKey = null; if(admin != null && admin.getProperty(SetupWizard.AuthenticationKey.class) != null) { setupKey = admin.getProperty(SetupWizard.AuthenticationKey.class).getKey(); } if(setupKey != null) { LOGGER.info("\n\n*************************************************************\n" + "*************************************************************\n" + "*************************************************************\n" + "\n" + "Jenkins initial setup is required. A security token is required to proceed. \n" + "Please use the following security token to proceed to installation: \n" + "\n" + "" + setupKey + "\n" + "\n" + "*************************************************************\n" + "*************************************************************\n" + "*************************************************************\n"); } try { PluginServletFilter.addFilter(FORCE_SETUP_WIZARD_FILTER); } catch (ServletException e) { throw new AssertionError(e); } }

Target:
public SetupWizard(Jenkins j) throws IOException { User admin; if(j.getSecurityRealm() == null || j.getSecurityRealm() == SecurityRealm.NO_AUTHENTICATION) { BulkChange bc = new BulkChange(j); HudsonPrivateSecurityRealm securityRealm = new HudsonPrivateSecurityRealm(false, false, null); j.setSecurityRealm(securityRealm); String randomUUID = UUID.randomUUID().toString().replace("-", "").toLowerCase(Locale.ENGLISH); admin = securityRealm.createAccount(SetupWizard.initialSetupAdminUserName, randomUUID); admin.addProperty(new SetupWizard.AuthenticationKey(randomUUID)); FullControlOnceLoggedInAuthorizationStrategy authStrategy = new FullControlOnceLoggedInAuthorizationStrategy(); authStrategy.setAllowAnonymousRead(false); j.setAuthorizationStrategy(authStrategy); j.setSlaveAgentPort(-1); j.setCrumbIssuer(new DefaultCrumbIssuer(false)); j.getInjector().getInstance(AdminWhitelistRule.class) .setMasterKillSwitch(false); try{ j.save(); } finally { bc.commit(); } } else { admin = j.getUser(SetupWizard.initialSetupAdminUserName); } String setupKey = null; if(admin != null && admin.getProperty(SetupWizard.AuthenticationKey.class) != null) { setupKey = admin.getProperty(SetupWizard.AuthenticationKey.class).getKey(); } if(setupKey != null) { LOGGER.info("\n\n*************************************************************\n" + "*************************************************************\n" + "*************************************************************\n" + "\n" + "Jenkins initial setup is required. A security token is required to proceed. \n" + "Please use the following security token to proceed to installation: \n" + "\n" + "" + setupKey + "\n" + "\n" + "*************************************************************\n" + "*************************************************************\n" + "*************************************************************\n"); } try { PluginServletFilter.addFilter(FORCE_SETUP_WIZARD_FILTER); } catch (ServletException e) { throw new AssertionError(e); } }