

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# TIP 플러그인을 사용하여에 액세스 AWS 서비스
<a name="access-tip"></a>

 신뢰할 수 있는 자격 증명 전파(TIP)는 관리자가 그룹 연결과 같은 사용자 속성을 기반으로 권한을 부여 AWS 서비스 할 수 AWS IAM Identity Center 있는의 기능입니다. 신뢰할 수 있는 자격 증명 전파를 통해 자격 증명 컨텍스트가 IAM 역할에 추가되어 AWS 리소스에 대한 액세스를 요청하는 사용자를 식별합니다. 이 컨텍스트는 다른 AWS 서비스에 전파됩니다.

 자격 증명 컨텍스트는가 액세스 요청을 수신할 때 권한 부여 결정을 내리는 데 AWS 서비스 사용하는 정보로 구성됩니다. 이 정보에는 요청자(예: IAM Identity Center 사용자), 액세스가 요청 AWS 서비스 되는 (예: Amazon Redshift) 및 액세스 범위(예: 읽기 전용 액세스)를 식별하는 메타데이터가 포함됩니다. 수신는이 컨텍스트와 사용자에게 할당된 모든 권한을 AWS 서비스 사용하여 리소스에 대한 액세스를 승인합니다. 자세한 내용은 AWS IAM Identity Center 사용 설명서의 [신뢰할 수 있는 자격 증명 전파 개요](https://docs.aws.amazon.com/singlesignon/latest/userguide/trustedidentitypropagation-overview.html)의 섹션을 참조하세요.

 TIP 플러그인은 신뢰할 수 AWS 서비스 있는 자격 증명 전파를 지원하는와 함께 사용할 수 있습니다. 참조 사용 사례로는 *Amazon Q Business 사용 설명서*의 [Configuring an Amazon Q Business application using AWS IAM Identity Center](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/create-application.html)를 참고하세요.

**참고**  
 Amazon Q Business를 사용하는 경우, 서비스별 지침은 [Configuring an Amazon Q Business application using AWS IAM Identity Center](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/create-application.html)를 참고하세요.

## TIP 플러그인을 사용하기 위한 사전 조건
<a name="prereq-tip"></a>

플러그인이 작동하려면 다음 리소스가 필요합니다.

1.  AWS SDK for Java 또는를 사용해야 합니다 AWS SDK for JavaScript.

1. 사용 중인 서비스가 신뢰할 수 있는 ID 전파를 지원하는지 확인합니다.

   자세한 내용은 *AWS IAM Identity Center 사용 설명서*에 있는 ‘IAM Identity Center와 통합되는 [AWS 관리형 애플리케이션 표의 **IAM Identity Center**](https://docs.aws.amazon.com/singlesignon/latest/userguide/awsapps-that-work-with-identity-center.html)를 통해 신뢰할 수 있는 ID 전파 활성화 열을 참고하세요.

1. IAM Identity Center와 신뢰할 수 있는 ID 전파(TIP)를 활성화하세요.

   *AWS IAM Identity Center 사용 설명서*의 [TIP 필수 조건 및 고려 사항](https://docs.aws.amazon.com/singlesignon/latest/userguide/trustedidentitypropagation-overall-prerequisites.html)을 참조하세요.

1. Identity Center와 통합된 애플리케이션이 있어야 합니다.

   *AWS IAM Identity Center 사용 설명서*의 [AWS 관리형 애플리케이션](https://docs.aws.amazon.com/singlesignon/latest/userguide/awsapps-quick-start-setting-up-identity-center-to-test-awsmanagedapps.html) 또는 [고객 관리형 애플리케이션](https://docs.aws.amazon.com/singlesignon/latest/userguide/customermanagedapps-trusted-identity-propagation-set-up-your-own-app-OAuth2.html)을 참조하세요.

1. 신뢰할 수 있는 토큰 발급자(TTI)를 설정하고 서비스를 IAM Identity Center에 연결해야 합니다.

   *AWS IAM Identity Center 사용 설명서*의 [신뢰할 수 있는 토큰 발급자의 사전 조건](https://docs.aws.amazon.com/singlesignon/latest/userguide/using-apps-with-trusted-token-issuer.html#trusted-token-issuer-prerequisites) 및 [신뢰할 수 있는 토큰 발급자 설정 작업](https://docs.aws.amazon.com/singlesignon/latest/userguide/setuptrustedtokenissuer.html#setuptrustedtokenissuer-tasks)을 참조하세요.

## 코드에서 TIP 플러그인 사용
<a name="using-tip"></a>

1. 신뢰할 수 있는 ID 전파 플러그인의 인스턴스를 생성합니다.

1. 와 상호 작용하기 위한 서비스 클라이언트 인스턴스를 생성하고 신뢰할 수 있는 자격 증명 전파 플러그인을 추가하여 서비스 클라이언트를 AWS 서비스 사용자 지정합니다.

TIP 플러그인은 다음 입력 매개변수를 사용합니다.
+ **`webTokenProvider`**: 고객이 외부 ID 제공업체로부터 OpenID 토큰을 얻기 위해 구현하는 함수입니다.
+ **`accessRoleArn`**: ID 강화 자격 증명을 가져오기 위해 사용자의 ID 컨텍스트와 함께 플러그인에서 수임할 IAM 역할 ARN입니다.
+ **`applicationArn`**: 클라이언트 또는 애플리케이션의 고유 식별자 문자열입니다. 이 값은 OAuth 권한이 구성된 애플리케이션 ARN입니다.
+ **`ssoOidcClient`**: (선택 사항) Java용 [https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/ssooidc/SsoOidcClient.html](https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/ssooidc/SsoOidcClient.html) 또는 JavaScript용 [https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-sso-oidc/](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-sso-oidc/)와 같은 SSO OIDC 클라이언트로, 사용자가 정의한 구성을 포함할 수 있습니다. 제공되지 않으면 `applicationRoleArn`을 사용하는 OIDC 클라이언트가 인스턴스화되고 사용됩니다.
+  **`stsClient`**: (선택사항) 고객이 정의한 구성을 사용하는 AWS STS 클라이언트로, 사용자의 ID 컨텍스트로 `accessRoleArn`을 수임하는 데 사용됩니다. 제공되지 않으면를 사용하는 AWS STS 클라이언트`applicationRoleArn`가 인스턴스화되고 사용됩니다.
+ **`applicationRoleArn`**: (선택 사항) OIDC와 AWS STS 클라이언트를 부트스트래핑할 수 `AssumeRoleWithWebIdentity` 있도록 로 수임할 IAM 역할 ARN입니다.
  + 제공하지 않는 경우, `ssoOidcClient` 및 `stsClient` 매개변수 **둘 다** 제공해야 합니다.
  + 제공하는 경우, `applicationRoleArn`은 `accessRoleArn` 매개변수와 동일한 값을 사용할 수 없습니다. `applicationRoleArn`은 accessRole을 수임하기 위해 사용되는 stsClient를 구성하는 데 사용됩니다. `applicationRole` 및 모두에 동일한 역할을 사용하는 경우 역할을 사용하여 자신을 수임(자체 역할 가정)하는 `accessRole`것을 의미하므로 권장되지 않습니다 AWS. 자세한 내용은 [공지 사항](https://aws.amazon.com/blogs/security/announcing-an-update-to-iam-role-trust-policy-behavior/)을 참조하세요.

### `ssoOidcClient`, `stsClient`, `applicationRoleArn` 매개변수에 대한 고려 사항
<a name="considerations-tip"></a>

TIP 플러그인을 구성할 때, 제공하는 매개변수에 따라 다음과 같은 권한 요구 사항을 고려해야 합니다.
+ `ssoOidcClient` 및 `stsClient`를 제공하는 경우:
  + `ssoOidcClient`에 설정된 자격 증명은 Identity Center를 직접 호출해 해당 Identity Center 전용 사용자 컨텍스트를 가져올 수 있는 `oauth:CreateTokenWithIAM` 권한을 보유해야 합니다.
  + `stsClient`에 설정된 자격 증명은 `accessRole`에서 `sts:AssumeRole` 및 `sts:SetContext` 권한을 가져야 합니다. 또한 `accessRole`은 `stsClient`에 있는 자격 증명과의 신뢰 관계도 구성해야 합니다.
+ `applicationRoleArn`을 제공하는 경우:
  + `applicationRole`은 OIDC와 STS 클라이언트를 생성하는 데 사용되므로, 필요한 리소스(IdC 인스턴스, `accessRole`)에 대해 `oauth:CreateTokenWithIAM`, `sts:AssumeRole`, `sts:SetContext` 권한을 보유해야 합니다.
  + `applicationRole`은 `webToken`을 생성하는 데 사용되는 ID 제공업체와 신뢰 관계를 가지고 있어야 합니다. 이는 플러그인이 [AssumeRoleWithWebIdentity](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html) 직접 호출을 통해 applicationRole을 수임할 때 `webToken`이 사용되기 때문입니다.

**ApplicationRole 구성의 예:**

웹 토큰 공급자의 신뢰 정책:

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Federated": "arn:aws:iam::ACCOUNT_ID:oidc-provider/IDENTITY_PROVIDER_URL"
            },
            "Action": "sts:AssumeRoleWithWebIdentity",
            "Condition": {
                "StringEquals": {
                    "IDENTITY_PROVIDER_URL:aud": "CLIENT_ID_TO_BE_TRUSTED"
                }
            }
        }
    ]
}
```

권한 정책:

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "sts:AssumeRole",
                "sts:SetContext"
            ],
            "Resource": [
                "accessRoleArn"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "sso-oauth:CreateTokenWithIAM"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}
```

## TIP를 사용한 코드 예제
<a name="tip-code-example"></a>

아래 예제에서는 AWS SDK for Java 또는를 사용하여 코드에 TIP 플러그인을 구현하는 방법을 보여줍니다 AWS SDK for JavaScript.

------
#### [ Java ]

 AWS SDK for Java 프로젝트에서 TIP 플러그인을 사용하려면 프로젝트 `pom.xml` 파일의 종속성으로 선언해야 합니다.

```
<dependency>
<groupId>software.amazon.awsidentity.trustedIdentityPropagation</groupId>
<artifactId>aws-sdk-java-trustedIdentityPropagation-java-plugin</artifactId>
   <version>2.0.0</version>
</dependency>
```

소스 코드에 `software.amazon.awssdk.trustedidentitypropagation`에 대한 필수 패키지 선언을 포함합니다.

아래 예제는 신뢰할 수 있는 ID 전파 플러그인 인스턴스를 생성하고 이를 서비스 클라이언트에 추가하는 두 가지 방법을 보여줍니다. 두 예제 모두 Amazon S3를 서비스로 사용하고 `S3AccessGrantsPlugin`를 사용하여 사용자별 권한을 관리하지만 신뢰할 수 AWS 서비스 있는 자격 증명 전파(TIP)를 지원하는 모든에 적용할 수 있습니다.

**참고**  
이 예제에서는 S3 Access Grants에서 사용자별 권한을 설정해야 합니다. 자세한 내용은 [S3 Access Grants 문서](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-grants.html)를 참고하세요.

**옵션 1: OIDC 및 STS 클라이언트 빌드 및 전달**

```
SsoOidcClient oidcClient = SsoOidcClient.builder()
    .region(Region.US_EAST_1)
    .credentialsProvider(credentialsProvider).build();

StsClient stsClient = StsClient.builder()
    .region(Region.US_EAST_1)
    .credentialsProvider(credentialsProvider).build();

TrustedIdentityPropagationPlugin trustedIdentityPropagationPlugin = TrustedIdentityPropagationPlugin.builder()
        .webTokenProvider(() -> webToken)
        .applicationArn(idcApplicationArn)
        .accessRoleArn(accessRoleArn)
        .ssoOidcClient(oidcClient)
        .stsClient(stsClient)
        .build();

S3AccessGrantsPlugin accessGrantsPlugin = S3AccessGrantsPlugin.builder()
        .build();

S3Client s3Client =
        S3Client.builder().region(Region.US_EAST_1)
                .crossRegionAccessEnabled(true)
                .addPlugin(trustedIdentityPropagationPlugin)
                .addPlugin(accessGrantsPlugin)
                .build();

final var resp = s3Client.getObject(GetObjectRequest.builder()
        .key("path/to/object/fileName")
        .bucket("bucketName")
        .build());
```

**옵션 2: applicationRoleArn 전달 및 플러그인으로의 클라이언트 생성 연기**

```
TrustedIdentityPropagationPlugin trustedIdentityPropagationPlugin = TrustedIdentityPropagationPlugin.builder()
        .webTokenProvider(() -> webToken)
        .applicationArn(idcApplicationArn)
        .accessRoleArn(accessRoleArn)
        .applicationRoleArn(applicationRoleArn)
        .build();

S3AccessGrantsPlugin accessGrantsPlugin = S3AccessGrantsPlugin.builder()
        .build();

S3Client s3Client =
        S3Client.builder().region(Region.US_EAST_1)
                .crossRegionAccessEnabled(true)
                .addPlugin(trustedIdentityPropagationPlugin)
                .addPlugin(accessGrantsPlugin)
                .build();

final var resp = s3Client.getObject(GetObjectRequest.builder()
        .key("path/to/object/fileName")
        .bucket("bucketName")
        .build());
```

추가 세부 정보 및 소스는 GitHub의 [ trusted-identity-propagation-java](https://github.com/aws-sdk-plugin/trusted-identity-propagation-java)를 참조하세요.

------
#### [ JavaScript ]

다음 명령을 실행하여 AWS SDK for JavaScript 프로젝트에 TIP 인증 플러그인 패키지를 설치합니다.

```
$  npm i @aws-sdk-extension/trusted-identity-propagation
```

최종 `package.json`에는 다음과 유사한 종속성이 포함되어야 합니다.

```
  "dependencies": {
"@aws-sdk-extension/trusted-identity-propagation": "^2.0.0"
  },
```

 소스 코드에서 필요한 `TrustedIdentityPropagationExtension` 종속성을 가져옵니다.

 아래 예제는 신뢰할 수 있는 ID 전파 플러그인 인스턴스를 생성하고 이를 서비스 클라이언트에 추가하는 두 가지 방법을 보여줍니다. 두 예제 모두 Amazon S3를 서비스로 사용하고 Amazon S3 Access Grants를 사용하여 사용자별 권한을 관리하지만 신뢰할 수 AWS 서비스 있는 자격 증명 전파(TIP)를 지원하는 모든에 적용할 수 있습니다.

**참고**  
이 예제에서는 Amazon S3 Access Grants에서 사용자별 권한을 설정해야 합니다. 자세한 내용은 [Amazon S3 Access Grants 문서](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-grants.html)를 참조하세요.

**옵션 1: OIDC 및 STS 클라이언트 빌드 및 전달**

```
import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";
import { S3ControlClient, GetDataAccessCommand } from "@aws-sdk/client-s3-control";
import { TrustedIdentityPropagationExtension } from "@aws-sdk-extension/trusted-identity-propagation";

const s3ControlClient = new S3ControlClient({
    region: "us-east-1",
    extensions: [
        TrustedIdentityPropagationExtension.create({
            webTokenProvider: async () => {
                return 'ID_TOKEN_FROM_YOUR_IDENTITY_PROVIDER';
            },
            ssoOidcClient: customOidcClient,
            stsClient: customStsClient,
            accessRoleArn: accessRoleArn,
            applicationArn: applicationArn,
        }),
    ],
});

const getDataAccessParams = {
  Target: "S3_URI_PATH",
  Permission: "READ",
  AccountId: ACCOUNT_ID,
  InstanceArn: S3_ACCESS_GRANTS_ARN,
  TargetType: "Object",
};

try {
  const command = new GetDataAccessCommand(getDataAccessParams);
  const response = await s3ControlClient.send(command);

  const credentials = response.Credentials;

  // Create a new S3 client with the temporary credentials
  const temporaryS3Client = new S3Client({
    region: "us-east-1",
    credentials: {
      accessKeyId: credentials.AccessKeyId,
      secretAccessKey: credentials.SecretAccessKey,
      sessionToken: credentials.SessionToken,
    },
  });

  // Use the temporary S3 client to perform the operation
  const s3Params = {
    Bucket: "BUCKET_NAME",
    Key: "S3_OBJECT_KEY",
  };
  const getObjectCommand = new GetObjectCommand(s3Params);
  const s3Object = await temporaryS3Client.send(getObjectCommand);

  const fileContent = await s3Object.Body.transformToString();

  // Process the S3 object data
  console.log("Successfully retrieved S3 object:", fileContent);
} catch (error) {
  console.error("Error accessing S3 data:", error);
}
```

**옵션 2: applicationRoleArn 전달 및 플러그인으로의 클라이언트 생성 연기**

```
import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";
import { S3ControlClient, GetDataAccessCommand } from "@aws-sdk/client-s3-control";
import { TrustedIdentityPropagationExtension } from "@aws-sdk-extension/trusted-identity-propagation";

const s3ControlClient = new S3ControlClient({
    region: "us-east-1",
    extensions: [
        TrustedIdentityPropagationExtension.create({
            webTokenProvider: async () => {
                return 'ID_TOKEN_FROM_YOUR_IDENTITY_PROVIDER';
            },
            accessRoleArn: accessRoleArn,
            applicationRoleArn: applicationRoleArn,
            applicationArn: applicationArn,
        }),
    ],
});

// Same S3 AccessGrants workflow as Option 1
const getDataAccessParams = {
  Target: "S3_URI_PATH",
  Permission: "READ",
  AccountId: ACCOUNT_ID,
  InstanceArn: S3_ACCESS_GRANTS_ARN,
  TargetType: "Object",
};

try {
  const command = new GetDataAccessCommand(getDataAccessParams);
  const response = await s3ControlClient.send(command);

  const credentials = response.Credentials;

  const temporaryS3Client = new S3Client({
    region: "us-east-1",
    credentials: {
      accessKeyId: credentials.AccessKeyId,
      secretAccessKey: credentials.SecretAccessKey,
      sessionToken: credentials.SessionToken,
    },
  });

  const s3Params = {
    Bucket: "BUCKET_NAME",
    Key: "S3_OBJECT_KEY",
  };
  const getObjectCommand = new GetObjectCommand(s3Params);
  const s3Object = await temporaryS3Client.send(getObjectCommand);

  const fileContent = await s3Object.Body.transformToString();

  console.log("Successfully retrieved S3 object:", fileContent);
} catch (error) {
  console.error("Error accessing S3 data:", error);
}
```

추가 세부 정보 및 소스는 GitHub의 [trusted-identity-propagation-js](https://github.com/aws-sdk-plugin/trusted-identity-propagation-js)를 참조하세요.

------