Skip to content

Commit

Permalink
Snapshot authentication credentials
Browse files Browse the repository at this point in the history
Create snapshot of authentication credentials so that they can be properly
serialized to the agent.

Fixes: JENKINS-69155
  • Loading branch information
cronik committed Oct 3, 2022
1 parent 22fbf8c commit 8a1fbf2
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ private HttpRequestExecution(
CredentialsProvider.trackAll(run, credential);

if (credential instanceof StandardUsernamePasswordCredentials) {
this.proxyCredentials = (StandardUsernamePasswordCredentials) credential;
// create snapshot of credentials because it needs to be serialized to the agent
this.proxyCredentials = CredentialsProvider.snapshot((StandardUsernamePasswordCredentials) credential);
} else {
this.proxyCredentials = null;
throw new IllegalStateException("Proxy authentication '" + proxyAuthentication + "' doesn't exist anymore or is not a username/password credential type");
Expand Down Expand Up @@ -232,6 +233,8 @@ private HttpRequestExecution(
CredentialsProvider.trackAll(run, credential);

if (credential != null) {
// create snapshot of credential because it needs to be serialized to the agent
credential = CredentialsProvider.snapshot(credential);
if (credential instanceof StandardUsernamePasswordCredentials) {
if (this.useNtlm) {
auth = new CredentialNtlmAuthentication((StandardUsernamePasswordCredentials) credential);
Expand Down

0 comments on commit 8a1fbf2

Please sign in to comment.