Skip to content

Commit

Permalink
[JENKINS-75014] Allow auth module to see sts module classes (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Dec 18, 2024
1 parent 0bc2603 commit c08280b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import java.util.Objects;
import java.util.Optional;
import jenkins.model.Jenkins;
import jenkins.util.SetContextClassLoader;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
Expand Down Expand Up @@ -182,7 +183,8 @@ private Credentials getSessionCredentials(AwsCredentialsProvider credentialsProv
* in case of error.
*/
private AwsSessionCredentials sessionCredentialsFromInstanceProfile() throws IOException {
try (DefaultCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create()) {
try (SetContextClassLoader sccl = new SetContextClassLoader(CredentialsAwsGlobalConfiguration.class);
DefaultCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create()) {
AwsCredentials awsCredentials = credentialsProvider.resolveCredentials();

// Assume we are using session credentials
Expand Down

0 comments on commit c08280b

Please sign in to comment.