인증되지 않은 ID에 대한 액세스 해제
이거 뭐야?
예비 지식
이른바 IdentityPool
Fig1: identity Pool의 역할
메시지
인증된 ID 및 인증되지 않은 ID
인증 ID
Fig2: 인증된 ID의 발행과 일시적인 신용 취득
인증되지 않은 ID
Fig3: 인증되지 않은 ID의 발행과 일시적인 신용 취득
인증되지 않은 ID를 사용하여 신용 증명 취득
identityPoolId
누구나 발행할 수 있다.# 認証されていないIDの発行
$aws cognito-identity get-id --identity-pool-id ${IDENTITY_POOL_ID} --query "IdentityId" --output text
us-east-1:xxx-xxxx-xxxx-xxx-xxx
# 一時クレデンシャルの取得
$aws cognito-identity get-credentials-for-identity --identity-id us-east-1:xxx-xxxx-xxxx-xxx-xxx
{
"IdentityId": "us-east-1:xxx-xxxx-xxxx-xxx-xxx",
"Credentials": {
"AccessKeyId": "xxxx",
"SecretKey": "xxxx",
"SessionToken": "xxxx",
"Expiration": "2021-05-05T12:15:31+09:00"
}
}
인증되지 않은 ID에 대한 액세스 해제
콘솔 상태
IDプールの編集
→認証されていない ID に対してアクセスを有効にする
의 체크 상자를 뜯어내세요.AWS CLI 시
$aws cognito-identity update-identity-pool --identity-pool-id ${IDENTITY_POOL_ID} --identity-pool-name ${IDENTITY_POOL_NAME} --no-allow-unauthenticated-identities
AWS CDK의 경우
allowUnauthenticatedIdentities
의 값을 가짜로 설정하고 디자인하면 반영할 수 있다.import { CfnIdentityPool } from '@aws-cdk/aws-cognito';
import { Construct, Stack, StackProps } from '@aws-cdk/core';
export class SampleCdkStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const identityPool = new CfnIdentityPool(this, 'myIdentityPool', {
// ここの値です。
allowUnauthenticatedIdentities: false,
});
}
}
결과를 반영하다
$aws cognito-identity get-id --identity-pool-id ${IDENTITY_POOL_ID} --query "IdentityId" --output text
An error occurred (NotAuthorizedException) when calling the GetId operation: Unauthenticated access is not supported for this identity pool.
참고물
Reference
이 문제에 관하여(인증되지 않은 ID에 대한 액세스 해제), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/kzen/articles/392bf636fdddb5텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)