Class AssumeRoleWithWebIdentityCredentials
AWS Credentials that automatically refresh by calling AssumeRole on the Amazon Security Token Service.
public class AssumeRoleWithWebIdentityCredentials : RefreshingAWSCredentials, IDisposable
- Inheritance
-
AssumeRoleWithWebIdentityCredentials
- Implements
- Inherited Members
Constructors
AssumeRoleWithWebIdentityCredentials(string, string, string)
Constructs an AssumeRoleWithWebIdentityCredentials object.
public AssumeRoleWithWebIdentityCredentials(string webIdentityTokenFile, string roleArn, string roleSessionName)
Parameters
webIdentityTokenFile
stringThe absolute path to the file on disk containing an OIDC token.
roleArn
stringThe Amazon Resource Name (ARN) of the role to assume.
roleSessionName
stringAn identifier for the assumed role session.
AssumeRoleWithWebIdentityCredentials(string, string, string, AssumeRoleWithWebIdentityCredentialsOptions)
Constructs an AssumeRoleWithWebIdentityCredentials object.
public AssumeRoleWithWebIdentityCredentials(string webIdentityTokenFile, string roleArn, string roleSessionName, AssumeRoleWithWebIdentityCredentialsOptions options)
Parameters
webIdentityTokenFile
stringThe absolute path to the file on disk containing an OIDC token.
roleArn
stringThe Amazon Resource Name (ARN) of the role to assume.
roleSessionName
stringAn identifier for the assumed role session.
options
AssumeRoleWithWebIdentityCredentialsOptionsOptions to be used in the call to AssumeRole.
Fields
RoleArnEnvVariable
public const string RoleArnEnvVariable = "AWS_ROLE_ARN"
Field Value
RoleSessionNameEnvVariable
public const string RoleSessionNameEnvVariable = "AWS_ROLE_SESSION_NAME"
Field Value
WebIdentityTokenFileEnvVariable
As established by STS, the regex used to validate the role session names is a string of 2-64 characters consisting of upper- and lower-case alphanumeric characters with no spaces. You can also include underscores or any of the following characters: =,.@-
public const string WebIdentityTokenFileEnvVariable = "AWS_WEB_IDENTITY_TOKEN_FILE"
Field Value
Properties
RoleArn
The Amazon Resource Name (ARN) of the role to assume.
public string RoleArn { get; }
Property Value
RoleSessionName
An identifier for the assumed role session.
public string RoleSessionName { get; }
Property Value
WebIdentityTokenFile
The absolute path to the file on disk containing an OIDC token
public string WebIdentityTokenFile { get; }
Property Value
Methods
CreateClient()
Gets a client to be used for AssumeRoleWithWebIdentity requests.
protected virtual ICoreAmazonSTS_WebIdentity CreateClient()
Returns
- ICoreAmazonSTS_WebIdentity
The STS client.
FromEnvironmentVariables()
Creates an instance of AssumeRoleWithWebIdentityCredentials from environment variables.
public static AssumeRoleWithWebIdentityCredentials FromEnvironmentVariables()
Returns
- AssumeRoleWithWebIdentityCredentials
The new credentials.
GenerateNewCredentials()
protected override RefreshingAWSCredentials.CredentialsRefreshState GenerateNewCredentials()
Returns
GenerateNewCredentialsAsync()
protected override Task<RefreshingAWSCredentials.CredentialsRefreshState> GenerateNewCredentialsAsync()