Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 168 commits into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from 166 commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
2caf075
Replacing Acegi Security with Spring Security
jglick Jul 15, 2020
82522cf
more
jglick Jul 17, 2020
62eba9c
Change of approach: completely deprecating org.acegisecurity types
jglick Jul 19, 2020
0c02c44
More conversion
jglick Jul 19, 2020
d898b35
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Jul 20, 2020
f573052
More
jglick Jul 20, 2020
07412a9
Progress
jglick Jul 20, 2020
0613a19
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Jul 21, 2020
6af8f1c
Seems that everything except uses of BeanBuilder now compiles
jglick Jul 21, 2020
9111057
Rewrite BeanBuilder configuration of security to plain old Java
jglick Jul 21, 2020
6601d98
core module now at least compiles
jglick Jul 21, 2020
b85c0d9
Starting to make tests compilable; will require changes to jenkins-te…
jglick Jul 21, 2020
cfd9831
Tweaking AuthenticationProcessingFilter2
jglick Jul 21, 2020
085f525
Comments
jglick Jul 21, 2020
26060aa
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Jul 21, 2020
c6f0e12
Merge branch 'support-log-formatter' into spring-5303
jglick Jul 21, 2020
c3f9efd
Better logging for ChainedServletFilter
jglick Jul 21, 2020
a8a661e
Can now log in; crumbs are broken though
jglick Jul 21, 2020
76b0885
Searched more extensively for references to Acegi Security
jglick Jul 21, 2020
12598a7
HttpSessionContextIntegrationFilter2 was critical after all; just too…
jglick Jul 21, 2020
a985a50
Comment
jglick Jul 21, 2020
4201baa
Fixing UserSeedProperty so that login works at last
jglick Jul 21, 2020
a36f410
Binary compatibility for QueueItemAuthenticator
jglick Jul 21, 2020
ae31edd
Fixing up QueueItemAuthenticator Javadoc
jglick Jul 21, 2020
6434178
Binary compatibility for SecurityRealm.AUTHENTICATED_AUTHORITY
jglick Jul 21, 2020
da40e4a
Binary compatibility for key methods of SecurityRealm and AbstractPas…
jglick Jul 21, 2020
1ed7887
Even trying to compile at this stage is a waste of CI resources
jglick Jul 22, 2020
3f163d8
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Jul 22, 2020
abb439d
Binary compatibility for User.impersonate and Jenkins.ANONYMOUS
jglick Jul 22, 2020
100ca91
Binary compatibility for ACL.{SYSTEM,impersonate,as}
jglick Jul 22, 2020
58364c2
Tests compile
jglick Jul 22, 2020
29e1b95
Giving up on subtyping relationships even for exceptions
jglick Jul 22, 2020
0ad56da
Implementing SecurityContext.to/fromSpring allows some functional tes…
jglick Jul 22, 2020
a4475c4
Do not want spring-jcl as it clashes with the commons-logging we bundle
jglick Jul 22, 2020
6dad321
Some progress on tests using Authentication
jglick Jul 22, 2020
62e73df
org.acegisecurity.userdetails.User must be defined for JenkinsRule.Du…
jglick Jul 22, 2020
998d673
Some tests are passing; may as well start trying CI
jglick Jul 22, 2020
aa73f20
@Wadeck helped me with TokenBasedRememberMeServices2
jglick Jul 23, 2020
d052fb8
TokenBasedRememberMeServices2Test.rememberMeAutoLoginFailure was asse…
jglick Jul 23, 2020
1f14f3c
Tracked down why WebClient.withBasicApiToken was not working in tests
jglick Jul 23, 2020
044c42c
Binary compatibility for CLICommand.{getTransportAuthentication,setTr…
jglick Jul 23, 2020
0609eaf
ClassFilterImplSanityTest
jglick Jul 23, 2020
5354321
Rewrote Authentication.to/fromSpring, fixing two tests in QueueTest
jglick Jul 23, 2020
091d0ca
Binary compatibility for Jenkins.getAuthentication
jglick Jul 23, 2020
11ec923
Some more sanity checks around ACL.isAnonymous
jglick Jul 23, 2020
4bdec83
Binary compatibility for remaining ACL methods
jglick Jul 23, 2020
d8e6bea
Special round-trip handling for ACL.SYSTEM for compatibility
jglick Jul 23, 2020
84cb57b
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Jul 23, 2020
cdf2e46
JobTest.readPermission failed because its @LocalData used a pre-jBCry…
jglick Jul 23, 2020
c95b476
Binary compatibility for User.getUserDetailsForImpersonation
jglick Jul 23, 2020
3910ebf
Binary compatibility for SecurityListener
jglick Jul 23, 2020
8a5bdf2
ExtendedReadPermissionTest failed because its @LocalData used a pre-j…
jglick Jul 23, 2020
7ca54e4
NPE in QueueItemAuthenticator
jglick Jul 23, 2020
091bc23
LastGrantedAuthoritiesPropertyTest was reliant on the sort order of a…
jglick Jul 23, 2020
43e8d29
StopBuildsCommandTest
jglick Jul 23, 2020
2aec3cb
Javadoc updates in TokenBasedRememberMeServices2
jglick Jul 23, 2020
4c7b6b3
Accidentally removed code which added sessionSeed
jglick Jul 23, 2020
3a2d857
makeTokenSignature can be called when a User is not yet in memory; ne…
jglick Jul 23, 2020
736bca4
Also accidentally deleted some code necessary to handle disableRememb…
jglick Jul 23, 2020
9902338
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Jul 23, 2020
061e106
Rename refactoring missed a couple of overrides
jglick Jul 24, 2020
06d4b16
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Jul 24, 2020
5adba3e
Binary compatibility for AccessControlled.hasPermission
jglick Jul 24, 2020
a5d60e4
Added back DataAccessResourceFailureException & DataRetrievalFailureE…
jglick Jul 24, 2020
7fdb8db
Binary compatibility for Queue.Item.authenticate and affiliated methods
jglick Jul 24, 2020
54c65ed
RememberMeServicesProxy is apparently unused by plugins, do not need …
jglick Jul 24, 2020
3094ae5
Javadoc fixes
jglick Jul 24, 2020
30b0079
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Jul 24, 2020
b1fcbc6
Compilation error in test
jglick Jul 24, 2020
6d96228
Incorrect code sample
jglick Jul 24, 2020
f3e6c04
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Jul 28, 2020
f69be2c
SecurityRealm.createFilter more legible with blocks
jglick Jul 28, 2020
ecf3acc
Minor cleanups in TokenBasedRememberMeServices2
jglick Jul 28, 2020
c382733
toSpring/fromSpring pattern for selected exception types
jglick Jul 28, 2020
4d7f00d
Apparently org.acegisecurity.Authentication.getAuthorities() could re…
jglick Jul 28, 2020
abf8251
NPE from SecurityContext
jglick Jul 28, 2020
7c5ce69
Added back AbstractAuthenticationToken (supertype e.g. of GithubAuthe…
jglick Jul 28, 2020
0ae2aaa
Binary compatibility for SecurityComponents
jglick Jul 28, 2020
bd53bea
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Jul 28, 2020
034ecff
Test compilation error
jglick Jul 28, 2020
b11f3e4
Run japicmp
jglick Jul 28, 2020
f32ed4f
Binary compatibility for Items.all and .allItems
jglick Jul 28, 2020
232194d
Binary compatibility for User.get
jglick Jul 28, 2020
530455c
Binary compatibility for ACL.isAnonymous
jglick Jul 28, 2020
545e347
Binary compatibility for ACLContext.getPreviousContext
jglick Jul 28, 2020
e27ec10
Adding @Restricted(NoExternalUse.class) to a couple of classes which …
jglick Jul 28, 2020
0a32650
Binary compatibility for SecurityRealm.getPostLogOutUrl
jglick Jul 28, 2020
c9662fb
ImpersonatingUserDetailsService does not seem to have ever been used …
jglick Jul 28, 2020
19cb4ad
Binary compatibility for ImpersonatingExecutorService and Impersonati…
jglick Jul 28, 2020
f49afdf
Binary compatibility for LastGrantedAuthoritiesProperty.getAuthorities
jglick Jul 28, 2020
09feb27
Wrong access modifier for AbstractPasswordBasedSecurityRealm.authenti…
jglick Jul 29, 2020
b7f1acc
SecurityRealm.findBean was only used in conjunction with BeanBuilder
jglick Jul 29, 2020
340e0f9
Javadoc error
jglick Jul 29, 2020
d0a125a
NPE from User.get
jglick Jul 29, 2020
697e555
Need to implement setDetails in former subtypes of AbstractAuthentica…
jglick Jul 29, 2020
ffdf039
Custom subtypes of UserDetails must be round-tripped
jglick Jul 29, 2020
a175d17
Need to translate UserDetails values for Authentication.principal
jglick Jul 29, 2020
a73186b
Align User.serialVersionUID with the Acegi Security version
jglick Jul 31, 2020
8711c7b
Deprecated stub for WebAuthenticationDetails
jglick Jul 31, 2020
28ddf31
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Jul 31, 2020
d545242
Added AuthenticationProvider & AbstractUserDetailsAuthenticationProvider
jglick Jul 31, 2020
2f3a61e
Adding FieldUtils, used by tests in a few plugins
jglick Jul 31, 2020
f77173c
Binary compatibility for PrincipalSid and GrantedAuthoritySid constru…
jglick Aug 3, 2020
1abe5c6
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Aug 3, 2020
6851e32
Restoring some methods in AuthenticationException, called from Abstra…
jglick Aug 3, 2020
4731952
Restoring serial form compatibility for GrantedAuthorityImpl
jglick Aug 3, 2020
e90cfa4
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Aug 3, 2020
50a470f
Restored SecurityContextImpl
jglick Aug 4, 2020
1ebb6a5
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Aug 4, 2020
a67b028
To avoid Java serialization issues, HudsonPrivateSecurityRealm.Detail…
jglick Aug 5, 2020
d94651e
Update detached ldap to compatible version from https://github.com/je…
jglick Aug 5, 2020
8f71d91
AccessDeniedException2Test → AccessDeniedException3Test
jglick Aug 6, 2020
7a063db
Ensure ExceptionTranslationFilter still works if a plugin throws Acce…
jglick Aug 6, 2020
1e41d5a
Binary compatibility for BasicHeaderAuthenticator
jglick Aug 6, 2020
cc029a3
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Aug 7, 2020
7b87b21
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Aug 21, 2020
b380b78
Restored AuthenticationServiceException
jglick Aug 21, 2020
64f820e
Binary compatibility for HudsonPrivateSecurityRealm.Details.getAuthor…
jglick Aug 21, 2020
b7ed635
Restored User.setAuthorities
jglick Aug 21, 2020
5711c49
To be useful from ActiveDirectoryUserDetail, overridable setAuthoriti…
jglick Aug 21, 2020
7befcfd
INFRA-266 Adjust test for plugins over https
timja Aug 24, 2020
80bcc26
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Aug 24, 2020
a878549
Merge branch 'UpdateCenter2Test.install' into spring-5303
jglick Aug 24, 2020
4845972
Merge branch 'fix-test' of github.com:timja/jenkins into spring-5303
jglick Aug 24, 2020
e2b6ff9
Round-tripping SecurityRealm.AUTHENTICATED_AUTHORITY as object identi…
jglick Aug 24, 2020
1a90114
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Aug 27, 2020
929dcd3
Catching and translating AuthenticationException & AcegiSecurityExcep…
jglick Aug 27, 2020
5f119f5
https://github.com/spring-projects/spring-security/releases/tag/5.3.4…
jglick Aug 28, 2020
2f6380c
Use JUnit 5
jglick Aug 28, 2020
fe269a9
While UsernameNotFoundException extends BadCredentialsException in Ac…
jglick Aug 28, 2020
5d87079
Documenting that Run.fromExternalizableId can throw AccessDeniedExcep…
jglick Aug 28, 2020
4eaf883
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Aug 31, 2020
17a7fcb
AbstractAuthenticationToken should be @Deprecated
jglick Sep 1, 2020
b7d7d89
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Sep 1, 2020
fd744d2
Apparently the ~2h of functional tests do not include the corner case…
jglick Sep 2, 2020
7fa8a12
Reverting unintentional Javadoc change
jglick Sep 2, 2020
2be2146
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Sep 14, 2020
657338c
Round-trip org.acegisecurity.Authentication, making LdapMultiEmbedded…
jglick Sep 14, 2020
4bb45a7
Round-trip DataAccessException, for PCT in LdapMultiEmbeddedTest
jglick Sep 14, 2020
862e4e5
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Sep 16, 2020
2bf6185
Bumping detached copy of ldap, for now to the release of https://gith…
jglick Sep 16, 2020
5b60ed0
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Sep 17, 2020
c020f8a
org.acegisecurity.ui.remember → org.acegisecurity.ui.rememberme
jglick Sep 18, 2020
ba608c3
TokenBasedRememberMeServices2 is not intended as an API
jglick Sep 18, 2020
dc589f1
UserDetailsSpringImpl can be marked deprecated to avoid warnings abou…
jglick Sep 18, 2020
1039b2b
Round-trip RememberMeServices subtypes, expected by crowd2
jglick Sep 18, 2020
419e44e
TokenBasedRememberMeServices placeholder for CrowdServletFilter
jglick Sep 18, 2020
950666e
crowd2 uses AccountExpiredException, CredentialsExpiredException, & I…
jglick Sep 18, 2020
14f2074
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Sep 21, 2020
df3ca87
https://github.com/spring-projects/spring-security/releases/tag/5.4.0
jglick Sep 21, 2020
e69a339
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Sep 28, 2020
b6d5a6e
Handle calls to super.getPostLogOutUrl without StackOverflowError
jglick Sep 28, 2020
4bed0db
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Sep 29, 2020
6548efe
Compatibility for ProviderNotFoundException
jglick Sep 29, 2020
eb4e22d
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Oct 6, 2020
df7c2e9
Binary compatibility for ImpersonatingUserDetailsService, used by at …
jglick Oct 6, 2020
83e4fe9
Restoring SecurityRealm.createCliAuthenticator to minimize disruption
jglick Oct 6, 2020
da3d17b
Restricted a lot of APIs which should not be used in plugins.
jglick Oct 6, 2020
7ff3ff5
Suppress some doclint as in https://github.com/jenkinsci/plugin-pom/p…
jglick Oct 6, 2020
7646dfd
Broken Javadoc reference after da3d17b85f80c47cd227ba4ab169508e19271c41
jglick Oct 6, 2020
d2ae6ca
Merge branch 'master' of github.com:jenkinsci/jenkins into spring-5303
jglick Oct 14, 2020
3e3792d
Merge branch 'master' of https://github.com/jenkinsci/jenkins into sp…
jglick Oct 19, 2020
3ce4ca3
https://github.com/spring-projects/spring-security/releases/tag/5.4.1
jglick Oct 19, 2020
899773e
Merge branch 'master' of https://github.com/jenkinsci/jenkins into sp…
jglick Oct 20, 2020
757e1a7
DisabledException & LockedException referenced from https://github.co…
jglick Oct 20, 2020
ffe273a
HttpSessionContextIntegrationFilter2 is used by cas and collabnet plu…
jglick Oct 20, 2020
a829508
Merge branch 'master' of https://github.com/jenkinsci/jenkins into sp…
jglick Oct 26, 2020
f04114c
Merge branch 'master' into spring-5303
timja Nov 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ for(j = 0; j < jdks.size(); j++) {
"MAVEN_OPTS=-Xmx1536m -Xms512m"], buildType, jdk) {
// Actually run Maven!
// -Dmaven.repo.local=… tells Maven to create a subdir in the temporary directory for the local Maven repository
def mvnCmd = "mvn -Pdebug -U -Dset.changelist help:evaluate -Dexpression=changelist -Doutput=$changelistF clean install ${runTests ? '-Dmaven.test.failure.ignore' : '-DskipTests'} -V -B -ntp -Dmaven.repo.local=$m2repo -e"
def mvnCmd = "mvn -Pdebug -Pjapicmp -U -Dset.changelist help:evaluate -Dexpression=changelist -Doutput=$changelistF clean install ${runTests ? '-Dmaven.test.failure.ignore' : '-DskipTests'} -V -B -ntp -Dmaven.repo.local=$m2repo -e"

if(isUnix()) {
sh mvnCmd
Expand All @@ -69,6 +69,7 @@ for(j = 0; j < jdks.size(); j++) {
allowEmptyArchive: true, // in case we forgot to reincrementalify
fingerprint: true
}
publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, includes: 'japicmp.html', keepAll: false, reportDir: 'core/target/japicmp', reportFiles: 'japicmp.html', reportName: 'API compatibility', reportTitles: 'japicmp report'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to merge this in?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}
}
Expand Down
31 changes: 7 additions & 24 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ THE SOFTWARE.
<guavaVersion>11.0.1</guavaVersion>
<slf4jVersion>1.7.30</slf4jVersion>
<stapler.version>1.260</stapler.version>
<spring.version>2.5.6.SEC03</spring.version>
<groovy.version>2.4.12</groovy.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency> <!-- https://docs.spring.io/spring-security/site/docs/5.4.0-M1/reference/html5/#getting-maven-no-boot -->
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-bom</artifactId>
<version>5.4.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
Expand Down Expand Up @@ -423,29 +429,6 @@ THE SOFTWARE.
<version>1.1-beta-11</version>
</dependency>

<!--Spring-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency><!-- Jenkins core doesn't use it but JENKINS-3881 requires us to put it. -->
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.acegisecurity</groupId>
<artifactId>acegi-security</artifactId>
<version>1.0.7</version>
</dependency>


<!-- Modules -->
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
Expand Down
62 changes: 39 additions & 23 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -385,16 +385,12 @@ THE SOFTWARE.
<artifactId>commons-jexl</artifactId>
</dependency>
<dependency>
<groupId>org.acegisecurity</groupId>
<artifactId>acegi-security</artifactId>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-remoting</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-support</artifactId>
<artifactId>spring-jcl</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand All @@ -412,22 +408,6 @@ THE SOFTWARE.
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
</dependency>
<dependency>
<!--
for Grails spring bean builder.
Ideally we should be able to modify BeanBuilder so as not to depend on this.
-->
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency><!-- Jenkins core doesn't use it but HUDSON-3811 requires us to put it. -->
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down Expand Up @@ -867,5 +847,41 @@ THE SOFTWARE.
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
</properties>
</profile>
<profile>
<id>japicmp</id>
<build>
<plugins>
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
<version>0.14.4-20200728.214757-1</version> <!-- TODO https://github.com/siom79/japicmp/pull/266 -->
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly doesn't look like something we want to merge in.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is OK because this is only used in a profile we active in CI, so if my PR never gets picked up we can either drop this profile, or use the last mojo release which will work for most purposes (just not complex library replacements like is done here).

Happy to remove it if you are uneasy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with leaving it. I actually ran the profile and examined the results. If Daniel is concerned, though, I readily accept the removal.

<configuration>
<parameter>
<!-- see https://siom79.github.io/japicmp/MavenPlugin.html -->
<oldVersionPattern>\d+[.]\d+</oldVersionPattern>
<!-- <onlyModified>true</onlyModified> -->
<onlyBinaryIncompatible>true</onlyBinaryIncompatible>
</parameter>
<oldClassPathDependencies>
<dependency> <!-- provided, so not visible in flattened artifact -->
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
</oldClassPathDependencies>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>cmp</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/DependencyRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public DependencyRunner(ProjectRunnable runnable) {
}

public void run() {
try (ACLContext ctx = ACL.as(ACL.SYSTEM)) {
try (ACLContext ctx = ACL.as2(ACL.SYSTEM2)) {
Set<AbstractProject> topLevelProjects = new HashSet<>();
// Get all top-level projects
LOGGER.fine("assembling top level projects");
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/ExpressionFactory2.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package hudson;

import org.acegisecurity.AcegiSecurityException;
import org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.expression.Expression;
Expand All @@ -15,6 +14,7 @@
import java.util.logging.Logger;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
import org.springframework.security.access.AccessDeniedException;

/**
* {@link ExpressionFactory} so that security exception aborts the page rendering.
Expand Down Expand Up @@ -72,7 +72,7 @@ public Object evaluate(JellyContext context) {
CURRENT_CONTEXT.set(context);
JexlContext jexlContext = new JellyJexlContext( context );
return expression.evaluate(jexlContext);
} catch (AcegiSecurityException e) {
} catch (AccessDeniedException e) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no replacement for AcegiSecurityException. AFAIK the purpose of this class is to nicely handle 403s, so this should be good enough.

// let the security exception pass through
throw e;
} catch (Exception e) {
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/ExtensionFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ public <T> void onProvision(ProvisionInvocation<T> provision) {
// so that we invoke them before derived class one. This isn't specified in JSR-250 but implemented
// this way in Spring and what most developers would expect to happen.

final Set<Class> interfaces = ClassUtils.getAllInterfacesAsSet(instance);
final Set<Class<?>> interfaces = ClassUtils.getAllInterfacesAsSet(instance);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a signature change in Spring.


while (c != Object.class) {
Arrays.stream(c.getDeclaredMethods())
Expand Down Expand Up @@ -607,7 +607,7 @@ public <T> void onProvision(ProvisionInvocation<T> provision) {
* This allows to introspect metadata for a method which is both declared in parent class and in implemented
* interface(s). {@code interfaces} typically is obtained by {@link ClassUtils#getAllInterfacesAsSet}
*/
Collection<Method> getMethodAndInterfaceDeclarations(Method method, Collection<Class> interfaces) {
Collection<Method> getMethodAndInterfaceDeclarations(Method method, Collection<Class<?>> interfaces) {
final List<Method> methods = new ArrayList<>();
methods.add(method);

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@
import jenkins.model.ModelObjectWithChildren;
import jenkins.model.ModelObjectWithContextMenu;

import org.acegisecurity.AccessDeniedException;
import org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.Script;
Expand Down Expand Up @@ -174,6 +173,7 @@
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.accmod.restrictions.DoNotUse;
import org.springframework.security.access.AccessDeniedException;

/**
* Utility functions used in views.
Expand Down Expand Up @@ -1770,7 +1770,7 @@ public static String toCCStatus(Item i) {
* Checks if the current user is anonymous.
*/
public static boolean isAnonymous() {
return ACL.isAnonymous(Jenkins.getAuthentication());
return ACL.isAnonymous2(Jenkins.getAuthentication2());
}

/**
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/hudson/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
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;
Expand Down Expand Up @@ -156,6 +155,7 @@

import static hudson.init.InitMilestone.*;
import static java.util.logging.Level.*;
import org.springframework.security.core.Authentication;

/**
* Manages {@link PluginWrapper}s.
Expand Down Expand Up @@ -884,7 +884,7 @@ public void dynamicLoad(File arc) throws IOException, InterruptedException, Rest
*/
@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;
Expand Down Expand Up @@ -951,7 +951,7 @@ public void dynamicLoad(File arc, boolean removeExisting, @CheckForNull List<Plu

@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.
Expand Down Expand Up @@ -1548,7 +1548,7 @@ private List<Future<UpdateCenter.UpdateCenterJob>> install(@NonNull Collection<S
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);
Expand Down Expand Up @@ -1578,7 +1578,7 @@ public void run() {
}
updateCenter.persistInstallStatus();
if(!failures) {
try (ACLContext acl = ACL.as(currentAuth)) {
try (ACLContext acl = ACL.as2(currentAuth)) {
InstallUtil.proceedToNextStateFrom(InstallState.INITIAL_PLUGINS_INSTALLING);
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/WebAppMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ public FileAndDescription getHomeDir(ServletContextEvent event) {
}

public void contextDestroyed(ServletContextEvent event) {
try (ACLContext old = ACL.as(ACL.SYSTEM)) {
try (ACLContext old = ACL.as2(ACL.SYSTEM2)) {
Jenkins instance = Jenkins.getInstanceOrNull();
try {
if (instance != null) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/cli/BuildCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ protected int run() throws Exception {
throw new IllegalStateException(msg);
}

Queue.Item item = ParameterizedJobMixIn.scheduleBuild2(job, 0, new CauseAction(new CLICause(Jenkins.getAuthentication().getName())), a);
Queue.Item item = ParameterizedJobMixIn.scheduleBuild2(job, 0, new CauseAction(new CLICause(Jenkins.getAuthentication2().getName())), a);
QueueTaskFuture<? extends Run<?,?>> f = item != null ? (QueueTaskFuture)item.getFuture() : null;

if (wait || sync || follow) {
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/hudson/cli/CLIAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
import jenkins.util.FullDuplexHttpService;
import jenkins.websocket.WebSocketSession;
import jenkins.websocket.WebSockets;
import org.acegisecurity.Authentication;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
import org.springframework.security.core.Authentication;

/**
* Shows usage of CLI and commands.
Expand Down Expand Up @@ -118,7 +118,7 @@ public HttpResponse doWs() {
if (!WebSockets.isSupported()) {
return HttpResponses.notFound();
}
Authentication authentication = Jenkins.getAuthentication();
Authentication authentication = Jenkins.getAuthentication2();
return WebSockets.upgrade(new WebSocketSession() {
ServerSideImpl connection;
class OutputImpl implements PlainCLIProtocol.Output {
Expand Down Expand Up @@ -269,7 +269,7 @@ void run() throws IOException, InterruptedException {
sendExit(2);
return;
}
command.setTransportAuth(authentication);
command.setTransportAuth2(authentication);
command.setClientCharset(encoding);
CLICommand orig = CLICommand.setCurrent(command);
try {
Expand Down Expand Up @@ -303,7 +303,7 @@ protected FullDuplexHttpService createService(StaplerRequest req, UUID uuid) thr
return new FullDuplexHttpService(uuid) {
@Override
protected void run(InputStream upload, OutputStream download) throws IOException, InterruptedException {
try (ServerSideImpl connection = new ServerSideImpl(new PlainCLIProtocol.FramedOutput(download), Jenkins.getAuthentication())) {
try (ServerSideImpl connection = new ServerSideImpl(new PlainCLIProtocol.FramedOutput(download), Jenkins.getAuthentication2())) {
new PlainCLIProtocol.FramedReader(connection, upload).start();
connection.run();
}
Expand Down
Loading