Documentation
¶
Overview ¶
Package aws provides functionality to retrieve OIDC tokens from AWS STS GetWebIdentityToken API. It defines a token source that implements oauth2.TokenSource, allowing for easy integration with OAuth2 libraries and frameworks. The package also includes support for custom claims and configurable options for audience, signing algorithm, and AWS configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPClient ¶
NewHTTPClient creates an HTTP client configured with GitHub Actions OIDC authentication. The opts parameter allows for configuring the token source, such as setting the audience, signing algorithm, or AWS configuration.
func NewTokenSource ¶
func NewTokenSource(opts ...Opt) oauth2.TokenSource
NewTokenSource creates a new token source configured with the provided options. It returns an oauth2.TokenSource that can be used to retrieve OIDC tokens from AWS.
Types ¶
type Claims ¶
type Claims struct {
jwtvalidator.RegisteredClaims
CustomClaims
}
Claims represents the JWT claims returned by the AWS OIDC provider, including both standard registered claims and custom AWS-specific claims.
type CustomClaims ¶
type CustomClaims struct {
HttpsStsAmazonawsCom struct {
Ec2InstanceSourceVpc string `json:"ec2_instance_source_vpc"`
Ec2RoleDelivery string `json:"ec2_role_delivery"`
OrgId string `json:"org_id"`
AwsAccount string `json:"aws_account"`
OuPath []string `json:"ou_path"`
OriginalSessionExp time.Time `json:"original_session_exp"`
SourceRegion string `json:"source_region"`
Ec2SourceInstanceArn string `json:"ec2_source_instance_arn"`
PrincipalId string `json:"principal_id"`
Ec2InstanceSourcePrivateIpv4 string `json:"ec2_instance_source_private_ipv4"`
} `json:"https://sts.amazonaws.com/"`
}
CustomClaims represents the custom claims included in the JWT token returned by AWS STS GetWebIdentityToken API. These claims provide additional information about the AWS environment and the context of the token issuance.
type Opt ¶
type Opt func(*tokenSource)
Opt defines a functional option for configuring the token source. It allows for setting various parameters such as audience, signing algorithm, and AWS configuration when creating a new token source.
func WithAWSConfig ¶
WithAWSConfig sets the AWS configuration for the token source
func WithAudience ¶
WithAudience sets the audience for the OIDC token
func WithSigningAlgorithm ¶
WithSigningAlgorithm sets the signing algorithm for the OIDC token