-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #616 from jtnord/JENKINS-69488
[JENKINS-69488] do not SnapShot GitHubAppCredentials
- Loading branch information
Showing
8 changed files
with
115 additions
and
60 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...in/java/org/jenkinsci/plugins/github_branch_source/GitHubAppCredentialsSnapshotTaker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.jenkinsci.plugins.github_branch_source; | ||
|
||
import com.cloudbees.plugins.credentials.CredentialsSnapshotTaker; | ||
import com.cloudbees.plugins.credentials.common.UsernamePasswordCredentials; | ||
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsSnapshotTaker; | ||
import hudson.Extension; | ||
|
||
/** | ||
* A {@link CredentialsSnapshotTaker} for {@link GitHubAppCredentials} that is a no-op. | ||
* | ||
* <p>As {@code GitHubAppCredentials} tokens are time limited they need to be refreshed | ||
* periodically. This is currently addressed by its use of the {@code writeReplace()} and {@code | ||
* readResolve}, but as these credentials are {@link UsernamePasswordCredentials} this behaviour | ||
* conflicts with the {@link UsernamePasswordCredentialsSnapshotTaker}. This SnapshotTaker restores | ||
* the status quo allowing the Credentials to be replaced using the existing mechanism. | ||
*/ | ||
@Extension | ||
public class GitHubAppCredentialsSnapshotTaker | ||
extends CredentialsSnapshotTaker<GitHubAppCredentials> { | ||
|
||
@Override | ||
public GitHubAppCredentials snapshot(GitHubAppCredentials credentials) { | ||
return credentials; | ||
} | ||
|
||
@Override | ||
public Class<GitHubAppCredentials> type() { | ||
return GitHubAppCredentials.class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ava/org/jenkinsci/plugins/github_branch_source/IgnoreDraftPullRequestFilterTraitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters