Skip to content

Commit

Permalink
Use session credentials to revoke access
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin-chappell committed Feb 12, 2025
1 parent 088f3b7 commit f2a07b1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/aws/Federation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import data.Policies
import logic.Date
import org.joda.time.{DateTime, DateTimeZone, Duration, Period}
import play.api.libs.json.Json
import software.amazon.awssdk.auth.credentials.AwsSessionCredentials
import software.amazon.awssdk.services.sts.StsClient
import software.amazon.awssdk.services.sts.model.{
AssumeRoleRequest,
Expand Down Expand Up @@ -170,7 +171,15 @@ object Federation {
stsClient,
Federation.awsMinimumSessionLength
)
val iamClient = IAM(creds.accessKeyId(), creds.secretAccessKey())
val sessionCredentials = AwsSessionCredentials.create(
creds.accessKeyId(),
creds.secretAccessKey(),
creds.sessionToken()
)
val iamClient = IAM(
sessionCredentials.accessKeyId(),
sessionCredentials.secretAccessKey()
)

// remove access from assumed role
val roleName = getRoleName(roleArn)
Expand Down

0 comments on commit f2a07b1

Please sign in to comment.