Skip to content

STS

kumolo implements a subset of the STS REST API. All operations accept standard AWS SDK v2 requests — point your client at http://localhost:5566.

SymbolMeaning
Fully implemented — the feature behaves like real AWS
Partial support — the operation works but has known limitations; see the note for details
Not yet implemented

Operations sourced from internal/sts/handler.go in the kumolo repository.

OperationSupported
GetCallerIdentity
AssumeRole
GetSessionToken
AssumeRoleWithWebIdentity
AssumeRoleWithSAML
GetFederationToken
DecodeAuthorizationMessage
GetAccessKeyInfo
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/credentials"
"github.com/aws/aws-sdk-go-v2/service/sts"
)
cfg, err := config.LoadDefaultConfig(context.Background(),
config.WithRegion("us-east-1"),
config.WithCredentialsProvider(
credentials.NewStaticCredentialsProvider("test", "test", ""),
),
)
if err != nil {
panic(err)
}
client := sts.NewFromConfig(cfg, func(o *sts.Options) {
o.BaseEndpoint = aws.String("http://localhost:5566")
})
identity, err := client.GetCallerIdentity(context.Background(), &sts.GetCallerIdentityInput{})
if err != nil {
panic(err)
}
fmt.Println("Account:", *identity.Account)
fmt.Println("ARN: ", *identity.Arn)
role, err := client.AssumeRole(context.Background(), &sts.AssumeRoleInput{
RoleArn: aws.String("arn:aws:iam::000000000000:role/my-role"),
RoleSessionName: aws.String("my-session"),
})
if err != nil {
panic(err)
}
fmt.Println("AccessKeyId:", *role.Credentials.AccessKeyId)
token, err := client.GetSessionToken(context.Background(), &sts.GetSessionTokenInput{})
if err != nil {
panic(err)
}
fmt.Println("SessionToken:", *token.Credentials.SessionToken)