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

Use Spring security API instead of Acegi security #1520

Merged
merged 5 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>1305.v5886374f499b_</version>
jglick marked this conversation as resolved.
Show resolved Hide resolved
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/hudson/plugins/git/UserRemoteConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@
return FormValidation.ok();
}
for (ListBoxModel.Option o : CredentialsProvider
.listCredentials(StandardUsernameCredentials.class, project, project instanceof Queue.Task
? Tasks.getAuthenticationOf((Queue.Task) project)
: ACL.SYSTEM,
.listCredentialsInItem(StandardUsernameCredentials.class, project, project instanceof Queue.Task
? Tasks.getAuthenticationOf2((Queue.Task) project)
: ACL.SYSTEM2,

Check warning on line 154 in src/main/java/hudson/plugins/git/UserRemoteConfig.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 152-154 are not covered by tests
GitURIRequirementsBuilder.fromUri(url).build(),
GitClient.CREDENTIALS_MATCHER)) {
if (Objects.equals(value, o.value)) {
Expand Down Expand Up @@ -259,7 +259,7 @@

private static StandardCredentials lookupCredentials(@CheckForNull Item project, String credentialId, String uri) {
return (credentialId == null) ? null : CredentialsMatchers.firstOrNull(
CredentialsProvider.lookupCredentials(StandardCredentials.class, project, ACL.SYSTEM,
CredentialsProvider.lookupCredentialsInItem(StandardCredentials.class, project, ACL.SYSTEM2,
GitURIRequirementsBuilder.fromUri(uri).build()),
CredentialsMatchers.withId(credentialId));
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -1288,8 +1288,8 @@ private StandardUsernameCredentials getCredentials(@CheckForNull Item context) {
}
return CredentialsMatchers
.firstOrNull(
CredentialsProvider.lookupCredentials(StandardUsernameCredentials.class, context,
ACL.SYSTEM, URIRequirementBuilder.fromUri(getRemote()).build()),
CredentialsProvider.lookupCredentialsInItem(StandardUsernameCredentials.class, context,
ACL.SYSTEM2, URIRequirementBuilder.fromUri(getRemote()).build()),
CredentialsMatchers.allOf(CredentialsMatchers.withId(credentialsId),
GitClient.CREDENTIALS_MATCHER));
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/jenkins/plugins/git/GitSCMFileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@
String credentialsId = config.getCredentialsId();
if (credentialsId != null) {
StandardCredentials credential = CredentialsMatchers.firstOrNull(
CredentialsProvider.lookupCredentials(
CredentialsProvider.lookupCredentialsInItem(

Check warning on line 371 in src/main/java/jenkins/plugins/git/GitSCMFileSystem.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 371 is not covered by tests
StandardUsernameCredentials.class,
owner,
ACL.SYSTEM,
ACL.SYSTEM2,
URIRequirementBuilder.fromUri(remote).build()
),
CredentialsMatchers.allOf(
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/jenkins/plugins/git/GitSCMSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,12 @@
return FormValidation.ok();
}

for (ListBoxModel.Option o : CredentialsProvider.listCredentials(
for (ListBoxModel.Option o : CredentialsProvider.listCredentialsInItem(
StandardUsernameCredentials.class,
context,
context instanceof Queue.Task
? Tasks.getAuthenticationOf((Queue.Task) context)
: ACL.SYSTEM,
? Tasks.getAuthenticationOf2((Queue.Task) context)
: ACL.SYSTEM2,

Check warning on line 459 in src/main/java/jenkins/plugins/git/GitSCMSource.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 454-459 are not covered by tests
URIRequirementBuilder.fromUri(remote).build(),
GitClient.CREDENTIALS_MATCHER)) {
if (Objects.equals(value, o.value)) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/jenkins/plugins/git/GitSCMTelescope.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@
String credentialsId = config.getCredentialsId();
if (credentialsId != null) {
List<StandardUsernameCredentials> urlCredentials = CredentialsProvider
.lookupCredentials(StandardUsernameCredentials.class, owner,
.lookupCredentialsInItem(StandardUsernameCredentials.class, owner,
owner instanceof Queue.Task
? Tasks.getAuthenticationOf((Queue.Task) owner)
: ACL.SYSTEM, URIRequirementBuilder.fromUri(remote).build());
? Tasks.getAuthenticationOf2((Queue.Task) owner)
: ACL.SYSTEM2, URIRequirementBuilder.fromUri(remote).build());

Check warning on line 201 in src/main/java/jenkins/plugins/git/GitSCMTelescope.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 198-201 are not covered by tests
credentials = CredentialsMatchers.firstOrNull(
urlCredentials,
CredentialsMatchers
Expand Down
Loading