A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.aws.amazon.com/awscloudtrail/latest/userguide/event_reference_user_identity.html below:

CloudTrail userIdentity element - AWS CloudTrail

CloudTrail userIdentity element

AWS Identity and Access Management (IAM) provides different types of identities. The userIdentity element contains details about the type of IAM identity that made the request, and which credentials were used. If temporary credentials were used, the element shows how the credentials were obtained.

Examples

userIdentity with IAM user credentials

The following example shows the userIdentity element of a simple request made with the credentials of the IAM user named Alice.

"userIdentity": {
    "type": "IAMUser",
    "principalId": "AIDAJ45Q7YFFAREXAMPLE",
    "arn": "arn:aws:iam::123456789012:user/Alice",
    "accountId": "123456789012",
    "accessKeyId": "",
    "userName": "Alice"
}

userIdentity with temporary security credentials

The following example shows a userIdentity element for a request made with temporary security credentials obtained by assuming an IAM role. The element contains additional details about the role that was assumed to get credentials.

"userIdentity": {
    "type": "AssumedRole",
    "principalId": "AROAIDPPEZS35WEXAMPLE:AssumedRoleSessionName",
    "arn": "arn:aws:sts::123456789012:assumed-role/RoleToBeAssumed/MySessionName",
    "accountId": "123456789012",
    "accessKeyId": "",
    "sessionContext": {
        "sessionIssuer": {
            "type": "Role",
            "principalId": "AROAIDPPEZS35WEXAMPLE",
            "arn": "arn:aws:iam::123456789012:role/RoleToBeAssumed",
            "accountId": "123456789012",
            "userName": "RoleToBeAssumed"
        },
        "attributes": {
            "mfaAuthenticated": "false",
            "creationDate": "20131102T010628Z"
        }    
    }
}

userIdentity for a request made on behalf of an IAM Identity Center user

The following example shows a userIdentity element for a request made on behalf of an IAM Identity Center user.

"userIdentity": {
    "type": "IdentityCenterUser",
    "accountId": "123456789012",
    "onBehalfOf": {
        "userId": "544894e8-80c1-707f-60e3-3ba6510dfac1",
        "identityStoreArn": "arn:aws:identitystore::123456789012:identitystore/d-9067642ac7" 
    },
    "credentialId": "EXAMPLEVHULjJdTUdPJfofVa1sufHDoj7aYcOYcxFVllWR_Whr1fEXAMPLE"
}

To learn more about how you can use userId, identityStoreArn, and credentialId, see Identifying the user and session in IAM Identity Center user-initiated CloudTrail events
 in the IAM Identity Center User Guide.

Fields

The following fields can appear in a userIdentity element.

type

The type of the identity. The following values are possible:

Optional: False

AWSAccount and AWSService appear for type in your logs when there is cross-account access using an IAM role that you own.

Example: Cross-account access initiated by another AWS account
  1. You own an IAM role in your account.

  2. Another AWS account switches to that role to assume the role for your account.

  3. Because you own the IAM role, you receive a log that shows the other account assumed the role. The type is AWSAccount. For an example log entry, see AWS STS API event in CloudTrail log file.

Example: Cross-account access initiated by an AWS service
  1. You own an IAM role in your account.

  2. An AWS account owned by an AWS service assumes that role.

  3. Because you own the IAM role, you receive a log that shows the AWS service assumed the role. The type is AWSService.

userName

The friendly name of the identity that made the call. The value that appears in userName is based on the value in type. The following table shows the relationship between type and userName:

type userName Description Root (no alias set) Not present If you haven't set up an alias for your AWS account, the userName field doesn't appear. For more information about account aliases, see Your AWS account ID and its alias. Note that the userName field can't contain Root, because Root is an identity type and not a user name. Root (alias set) The account alias For more information about AWS account aliases, see Your AWS account ID and its alias. IAMUser The user name of the IAM user

AssumedRole

Not present For the AssumedRole type, you can find the userName field in sessionContext as part of the sessionIssuer element. For an example entry, see Examples.

Role

User-defined The sessionContext and sessionIssuer section contains information about the identity that issued the session for the role. FederatedUser Not present The sessionContext and sessionIssuer section contains information about the identity that issued the session for the federated user. Directory Can be present For example, the value can be the account alias or email address of the associated AWS account ID. AWSService Not present AWSAccount Not present IdentityCenterUser Not present*

The onBehalfOf section contains information about the IAM Identity Center user ID and identity store ARN for which the call was made. To learn more about how you can use these two fields, see Identifying the user and session in IAM Identity Center user-initiated CloudTrail events
 in the IAM Identity Center User Guide.

* IAM Identity Center emits the userName field under the additionalEventData element in two sign-in CloudTrail events. For more information, see Username in sign-in CloudTrail events in the IAM Identity Center User Guide.

Unknown Can be present For example, the value can be the account alias or email address of the associated AWS account ID.

Note

The userName field contains the string HIDDEN_DUE_TO_SECURITY_REASONS when the recorded event is a console sign-in failure caused by incorrect user name input. CloudTrail does not record the contents in this case because the text could contain sensitive information, as in the following examples:

Optional: True

principalId

A unique identifier for the entity that made the call. For requests made with temporary security credentials, this value includes the session name that is passed to the AssumeRole, AssumeRoleWithWebIdentity, or GetFederationToken API call.

Optional: True

arn

The Amazon Resource Name (ARN) of the principal that made the call. The last section of the arn contains the user or role that made the call.

Optional: True

accountId

The account that owns the entity that granted permissions for the request. If the request was made with temporary security credentials, this is the account that owns the IAM user or role used to obtain credentials.

If the request was made with an IAM Identity Center authorized access token, this is the account that owns the IAM Identity Center instance.

Optional: True

accessKeyId

The access key ID that was used to sign the request. If the request was made with temporary security credentials, this is the access key ID of the temporary credentials. For security reasons, accessKeyId might not be present, or might be displayed as an empty string.

Optional: True

sessionContext

If the request was made with temporary security credentials, sessionContext provides information about the session created for those credentials. You create a session when you call any API that returns temporary credentials. Users also create sessions when they work in the console and make requests with APIs that include multi-factor authentication. The following attributes can appear in sessionContext:

Optional: True

invokedBy

The name of the AWS service that made the request, when a request is made by an AWS service such as Amazon EC2 Auto Scaling or AWS Elastic Beanstalk. This field is only present when a request is made by an AWS service. This includes requests made by services using forward access sessions (FAS), AWS service principals, service-linked roles, or service roles used by an AWS service.

Optional: True

onBehalfOf

If the request was made by an IAM Identity Center caller, onBehalfOf provides information about the IAM Identity Center user ID and identity store ARN for which the call was made. This element has the following attributes:

Optional: True

inScopeOf

If the request was made in scope of an AWS service, such as Lambda or Amazon ECS, it provides information about the resource or credentials related to the request. This element can contain the following attributes:

Optional: True

credentialId

The credential ID for the request. This is only set when the caller uses a bearer token, such as an IAM Identity Center authorized access token.

Optional: True

Values for AWS STS APIs with SAML and web identity federation

AWS CloudTrail supports logging AWS Security Token Service (AWS STS) API calls made with Security Assertion Markup Language (SAML) and web identity federation. When a user makes a call to the AssumeRoleWithSAML and AssumeRoleWithWebIdentity APIs, CloudTrail records the call and delivers the event to your Amazon S3 bucket.

The userIdentity element for these APIs contains the following values.

type

The identity type.

principalId

A unique identifier for the entity that made the call.

userName

The name of the identity that made the call.

identityProvider

The principal name of the external identity provider. This field appears only for SAMLUser or WebIdentityUser types.

The following is an example userIdentity element for the AssumeRoleWithWebIdentity action.

"userIdentity": {
    "type": "WebIdentityUser",
    "principalId": "accounts.google.com:application-id.apps.googleusercontent.com:user-id",
    "userName": "user-id",
    "identityProvider": "accounts.google.com"
  }

For example logs of how the userIdentity element appears for SAMLUser and WebIdentityUser types, see Logging IAM and AWS STS API calls with AWS CloudTrail.

AWS STS source identity

An IAM administrator can configure AWS Security Token Service to require that users specify their identity when they use temporary credentials to assume roles. The sourceIdentity field occurs in events when users assume an IAM role or perform any actions with the assumed role.

The sourceIdentity field identifies the original user identity making the request, whether that user's identity is an IAM user, an IAM role, a user authenticated by using SAML-based federation, or a user authenticated by using OpenID Connect (OIDC)-compliant web identity federation. After the IAM administrator configures AWS STS, CloudTrail logs sourceIdentity information in the following events and locations within the event record:

For more information about how to configure AWS STS to collect source identity information, see Monitor and control actions taken with assumed roles in the IAM User Guide. For more information about AWS STS events that are logged to CloudTrail, see Logging IAM and AWS STS API calls with AWS CloudTrail in the IAM User Guide.

The following are example snippets of events that show the sourceIdentity field.

Example requestParameters section

In the following example event snippet, a user makes an AWS STS AssumeRole request, and sets a source identity, represented here by source-identity-value-set. The user assumes a role represented by the role ARN arn:aws:iam::123456789012:role/Assumed_Role. The sourceIdentity field is in the requestParameters block of the event.

"eventVersion": "1.05",
    "userIdentity": {
        "type": "AWSAccount",
        "principalId": "AIDAJ45Q7YFFAREXAMPLE",
        "accountId": "123456789012"
    },
    "eventTime": "2020-04-02T18:20:53Z",
    "eventSource": "sts.amazonaws.com",
    "eventName": "AssumeRole",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "203.0.113.64",
    "userAgent": "aws-cli/1.16.96 Python/3.6.0 Windows/10 botocore/1.12.86",
    "requestParameters": {
        "roleArn": "arn:aws:iam::123456789012:role/Assumed_Role",
        "roleSessionName": "Test1",
        "sourceIdentity": "source-identity-value-set",
    },

Example responseElements section

In the following example event snippet, a user makes an AWS STS AssumeRole request to assume a role named Developer_Role, and sets a source identity, Admin. The user assumes a role represented by the role ARN arn:aws:iam::111122223333:role/Developer_Role. The sourceIdentity field is shown in both the requestParameters and responseElements blocks of the event. The temporary credentials used to assume the role, the session token string, and the assumed role ID, session name, and session ARN are shown in the responseElements block, along with the source identity.

    "requestParameters": {
        "roleArn": "arn:aws:iam::111122223333:role/Developer_Role",
        "roleSessionName": "Session_Name",
        "sourceIdentity": "Admin"
    },
    "responseElements": {
        "credentials": {
            "accessKeyId": "ASIAIOSFODNN7EXAMPLE",
            "expiration": "Jan 22, 2021 12:46:28 AM",
            "sessionToken": "XXYYaz...
                             EXAMPLE_SESSION_TOKEN
                             XXyYaZAz"
        },
        "assumedRoleUser": {
            "assumedRoleId": "AROACKCEVSQ6C2EXAMPLE:Session_Name",
            "arn": "arn:aws:sts::111122223333:assumed-role/Developer_Role/Session_Name"
        },
        "sourceIdentity": "Admin"
    }
...

Example sessionContext section

In the following example event snippet, a user is assuming a role named DevRole to call an AWS service API. The user sets a source identity, represented here by source-identity-value-set. The sourceIdentity field is in the sessionContext block, within the userIdentity block of the event.

{
  "eventVersion": "1.08",
  "userIdentity": {
    "type": "AssumedRole",
    "principalId": "AROAJ45Q7YFFAREXAMPLE: Dev1",
    "arn": "arn: aws: sts: : 123456789012: assumed-role/DevRole/Dev1",
    "accountId": "123456789012",
    "accessKeyId": "ASIAIOSFODNN7EXAMPLE",
    "sessionContext": {
      "sessionIssuer": {
        "type": "Role",
        "principalId": "AROAJ45Q7YFFAREXAMPLE",
        "arn": "arn: aws: iam: : 123456789012: role/DevRole",
        "accountId": "123456789012",
        "userName": "DevRole"
      },
      "webIdFederationData": {},
      "attributes": {
        "mfaAuthenticated": "false",
        "creationDate": "2021-02-21T23: 46: 28Z"
      },
      "sourceIdentity": "source-identity-value-set"
    }
  }
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4