์ฌ์ฉ์๊ฐ ํ์๊ฐ์ ์ ํ ๋ username(userId)๊ณผ ๊ฐ๋จํ ์ ๋ณด๋ง DB์ ์ ์ฅํ๊ณ , ๋น๋ฐ๋ฒํธ๋ AWS Cognito์ ์ ์ฅํ๋๋ก ํ ๊ฒ์ด๋ค.
AWS Cognito ๋ ?
์ด ๋ถ๋ถ์ ๋ํด ์ ๋ฆฌํ ๊ธ์ด ์๊ธฐ ๋๋ฌธ์ ์์ธํ ์ค๋ช ์ ์๋ตํ๊ณ ,
์ฌ์ฉ์ ํ์ ์ฌ์ฉํด ์ธ์ฆํ๊ณ ์๋ ๊ตฌ์กฐ๋ฅผ ํ์ฉํ๋ค ! ๋ผ๋ ๊ฒ๋ง ํ์ธํ๊ณ ๋์ด๊ฐ์.
โณ๏ธ ์ฌ์ฉ์ ํ์ ์ฌ์ฉํ ์ธ์ฆ
๐ท ์ธ์ฆ ํ๋ฆ
- ์ฌ์ฉ์ ๋ฑ๋ก (Sign Up)
- ์ฌ์ฉ์๊ฐ ์ฌ์ฉ์ ํ์ ๋ฑ๋ก
- ์ฌ์ฉ์ ์ด๋ฆ, ๋น๋ฐ๋ฒํธ, ์ด๋ฉ์ผ/์ ํ๋ฒํธ ๋ฑ์ ์ฌ์ฉ์ ์์ฑ ์ ๋ ฅ
- ์ด๋ฉ์ผ ๋๋ ์ ํ๋ฒํธ๋ฅผ ํตํด verification code๋ฅผ ๋ฐ์ ๋ฑ๋ก ์๋ฃ
- ์ฌ์ฉ์ ์ธ์ฆ (Sign In)
- ๋ฑ๋ก๋ ์ฌ์ฉ์๊ฐ ์ฌ์ฉ์ ์ด๋ฆ๊ณผ ๋น๋ฐ๋ฒํธ๋ก ์ธ์ฆ
- ์ธ์ฆ ์ฑ๊ณต ์, ID ํ ํฐ, accessToken, refreshToken ๋ฐํ
- ํ ํฐ์ JWT ํ์์ด๋ฉฐ ์ธ์ฆ๋ ์ฌ์ฉ์์ ์ ๋ณด๋ฅผ ๋ด๊ณ ์์
- ์ธ์ฆ ํ ํฐ ๋ฐ๊ธ
- ID ํ ํฐ : ์ฌ์ฉ์์ ์ธ์ฆ ์ํ ๋ฐ ์์ฑ ํฌํจ
- accessToken : ์ดํ๋ฆฌ์ผ์ด์ ์์ ๋ณดํธ๋ ๋ฆฌ์์ค์ ์ก์ธ์คํ๋ ๋ฐ ์ฌ์ฉ
- refreshToken : accessToken๊ณผ ID ํ ํฐ ๊ฐฑ์ ํ๋ ๋ฐ ์ฌ์ฉ
- ํ ํฐ ๊ฐฑ์
- accessToken๊ณผ ID Token์ด ๋ง๋ฃ๋๋ฉด refreshToken์ ์ฌ์ฉํด ์ ํ ํฐ ์์ฒญ
์ฌ์ฉ์ ๋ฑ๋ก - signUp
โณ๏ธ signUp
CognitoIdentityProviderAsyncClient (AWS SDK for Java - 2.30.2)
AWS SDK for Java API Reference - 2.30.2
sdk.amazonaws.com
- Amazon Cognito User Pools์์ ์ฌ์ฉ์๋ฅผ ๋ฑ๋กํ๋ ๊ธฐ๋ฅ ์ ๊ณต
- SMS ๋ฐ ์ด๋ฉ์ผ์ ์ฌ์ฉํด ์ธ์ฆ ๊ณผ์ ์์ฑ ๊ฐ๋ฅ
- ์ฌ์ฉ์ ์ด๋ฆ, ๋น๋ฐ๋ฒํธ, ์ฌ์ฉ์ ์์ฑ์ ์ง์ ๋ User Pool์ ๋ฑ๋ก ๊ฐ๋ฅ
- SignUpRequest๋ ์ฌ์ฉ์๋ฅผ ๋ฑ๋กํ๊ธฐ ์ํ ์์ฒญ ๊ฐ์ฒด๋ก, ์ฌ์ฉ์ ์ด๋ฆ, ๋น๋ฐ๋ฒํธ, ์์ฑ ๋ฑ ํฌํจ
โณ๏ธadminConfirmSignUp
CognitoIdentityProviderAsyncClient (AWS SDK for Java - 2.30.2)
AWS SDK for Java API Reference - 2.30.2
sdk.amazonaws.com
AdminConfirmSignUp - Amazon Cognito User Pools
When you use the ClientMetadata parameter, note that Amazon Cognito won't do the following: Store the ClientMetadata value. This data is available only to AWS Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool c
docs.aws.amazon.com
- ๊ด๋ฆฌ์ ๊ถํ์ ํตํด ๊ฐ์ ํ์ธ ์ฒ๋ฆฌ
- ์ฌ์ฉ์๊ฐ ๊ฐ์ ํ์ธ ์ฝ๋ ์ ๋ ฅ ํ์์์ด ๋ฐ๋ก ํ์ฑํ๋จ
- IAM ์๊ฒฉ ์ฆ๋ช ์ ํตํด ๊ถํ์ ๋ถ์ฌ๋ฐ์์ผ ํ๋ฉฐ ํด๋น ๊ถํ์ ๋ถ์ฌ๋ฐ์ ํ ๋ฉ์๋ ์คํ
- ์ฌ์ฉ์ ํ์์ ์ ์ฌ์ฉ์๊ฐ ๊ฐ์ ํ ๋, ๊ฐ์ ํ์ธ์ ์ํด ์ฝ๋๋ฅผ ์ ๋ ฅํ๋ ๋์ ์ด API๋ฅผ ์ฌ์ฉํ์ฌ ๊ด๋ฆฌ์๊ฐ ์ง์ ์น์ธ ์ฒ๋ฆฌ
๐ ๋ ๋ฉ์๋์ ์ฐจ์ด
๐ธ signUp
- ์ผ๋ฐ ์ฌ์ฉ์๊ฐ ์์ ์ ๊ณ์ ์ ์ง์ ์์ฑํ ๋ ์ฌ์ฉ
- Cognito๋ ์๋์ผ๋ก ๊ฐ์ ํ์ธ ์ฝ๋๋ฅผ ์ ์กํ์ฌ ์ฌ์ฉ์๊ฐ ์ด๋ฉ์ผ ๋๋ SMS๋ฅผ ํตํด ์ธ์ฆ
- ๊ฐ์ ํ ์ฌ์ฉ์๋ Cognito์์ ์ ๊ณตํ๋ ํ์ธ ์ฝ๋๋ฅผ ์ ๋ ฅํด์ผ๋ง ๊ณ์ ํ์ฑํ๋จ
๐ธ adminConfirmSignUp
- ๊ด๋ฆฌ์๊ฐ ์ฌ์ฉ์์ ๊ฐ์ ์ ์ง์ ์น์ธํ ๋ ์ฌ์ฉ
- ์ฌ์ฉ์๊ฐ ๊ฐ์ ํ ๋ ๊ฐ์ ํ์ธ ์ฝ๋๋ฅผ ์ ๋ ฅํ ํ์ ์์ด ๊ด๋ฆฌ์๊ฐ ์ด API ๋ฅผ ํตํด ์ง์ ์ฌ์ฉ์ ๊ณ์ ํ์ฑํ
๐ signUp ์คํ ์๋ฃ ํ adminConfirmSignUp์ ์คํํ๋ ํ๋ฆ์ผ๋ก ์งํํ๋ค. ์ฌ์ฉ์๊ฐ ๊ฐ์ ์ ์ฒญ์ ํ๋, ๊ฐ์ ํ์ธ ์ฝ๋๋ฅผ ์๋ตํ๊ณ ๊ด๋ฆฌ์๊ฐ ๊ฐ์ ์ ์น์ธํ๋ ๋ฐฉ์์ด๋ค.
์ฌ์ฉ์ ๋ก๊ทธ์ธ & ๋ฆฌํ๋ ์ฌ ํ ํฐ - initiateAuth
์ฌ์ฉ์์ ๋ก๊ทธ์ธ์ ์์ํ๋ ๊ธฐ๋ฅ
๐ ์ฌ์ฉ์๊ฐ Cognito User Pool์ ๋ก๊ทธ์ธํ๋๋ก ์์ฒญ
โณ๏ธ initiateAuth
- ๋ก๊ทธ์ธ ์์๋ authFlowType์ USER_PASSWORD_AUTH๋ก ์ ํ
- ๋ก๊ทธ์ธ ์ ์ง๋ฅผ ์ํด์๋ REFRESH_TOKEN_AUTH ๋๋ REFRESH_TOKEN ์ฌ์ฉ
๊ธฐ์กด์ ๋ฐ์ Refresh Token์ ์ฌ์ฉํ์ฌ ์๋ก์ด ID ๋ฐ access token ๋ฐ๊ธ
์ฌ์ฉ์ ๋ก๊ทธ์์ - adminUserGlobalSignOut
์ฌ์ฉ์๊ฐ ๋ก๊ทธ์ธํ ๋ชจ๋ ์ธ์ ์ ๊ฐ์ ๋ก ๋ก๊ทธ์์์ํค๋ ๊ธฐ๋ฅ
โณ๏ธ adminUserGlobalSignOut
AdminUserGlobalSignOut - Amazon Cognito User Pools
AdminUserGlobalSignOut Invalidates the identity, access, and refresh tokens that Amazon Cognito issued to a user. Call this operation with your administrative credentials when your user signs out of your app. This results in the following behavior. Amazon
docs.aws.amazon.com
์ฌ์ฉ์ ์ ๋ฐ์ดํธ - adminUpdateUserAttributes
ํน์ ์ฌ์ฉ์์ ์์ฑ ์ ๋ฐ์ดํธํ๋ ๊ธฐ๋ฅ
โณ๏ธ adminUpdateUserAttributes
AdminUpdateUserAttributes - Amazon Cognito User Pools
This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must re
docs.aws.amazon.com
์ฌ์ฉ์ ์ญ์ - adminDeleteUser
ํด๋น ์ฌ์ฉ์๋ฅผ ๊ด๋ฆฌ์ ๊ถํ์ผ๋ก ์ญ์ ํ๋ ์์ ์ํ
โณ๏ธ adminDeleteUser
CognitoIdentityProviderAsyncClient (AWS SDK for Java - 2.30.2)
AWS SDK for Java API Reference - 2.30.2
sdk.amazonaws.com
AdminDeleteUserAttributes - Amazon Cognito User Pools
Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better.
docs.aws.amazon.com
- ํธ์ถ ์ ํ๋ก ์ฑ๋ฅ ๋ฉํธ๋ฆญ ์์ง
- ์์ฒญ ๋ฐ ์๋ต ์ฒ๋ฆฌํ๋ ํธ๋ค๋ฌ ์ค์
๋น๋ฐ๋ฒํธ ์ด๊ธฐํ
์ฌ์ฉ์์ ๋น๋ฐ๋ฒํธ ์ค์
โณ๏ธ adminSetUserPassword
AdminSetUserPassword - Amazon Cognito User Pools
AdminSetUserPassword Sets the specified user's password in a user pool. This operation administratively sets a temporary or permanent password for a user. With this operation, you can bypass self-service password changes and permit immediate sign-in with t
docs.aws.amazon.com
- ํน์ ์ฌ์ฉ์ ํ์ ์ฌ์ฉ์์ ๋น๋ฐ๋ฒํธ ์ค์ ํ๋ ๊ธฐ๋ฅ
โณ๏ธ respondToAuthChallenge
RespondToAuthChallenge - Amazon Cognito User Pools
In a NEW_PASSWORD_REQUIRED challenge response, you can't modify a required attribute that already has a value. In AdminRespondToAuthChallenge or RespondToAuthChallenge, set a value for any keys that Amazon Cognito returned in the requiredAttributes paramet
docs.aws.amazon.com
- ์ฌ์ฉ์ ํ์์ ์ธ์ฆ ๊ณผ์ ์ค ๋ฐ์ํ๋ challenge(์ถ๊ฐ ์ธ์ฆ)์ ๋ํ ์๋ต ์ ๊ณต
- ์ฑ๋ฆฐ์ง ์์
- MFA (Multi-Factor Authentication) : ์ฌ์ฉ์๊ฐ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํ๋ฉด OTP ์ ๋ ฅ ์๊ตฌ
- NEW_PASSWORD_REQUIRED : ๊ด๋ฆฌ์๊ฐ ์์ ๋น๋ฐ๋ฒํธ๋ฅผ ์ค์ ํ ๊ฒฝ์ฐ, ์ฌ์ฉ์๊ฐ ๋ก๊ทธ์ธํ๋ฉด ์๋ก์ด ๋น๋ฐ๋ฒํธ ์ค์
- DEVICE_VERIFICATION : ๊ธฐ๊ธฐ์ธ์ฆ ์ฝ๋ ์ ๋ ฅ ์๊ตฌ
- CUSTOM_CHALLENGE : ๊ฐ๋ฐ์๊ฐ ์ง์ ์ ์ํ ๋ณด์ ์ ์ฐจ ์ถ๊ฐ
์ฐธ๊ณ ์๋ฃ
https://docs.aws.amazon.com/ko_kr/cognito/latest/developerguide/authentication.html
https://docs.aws.amazon.com/ko_kr/cognito-user-identity-pools/latest/APIReference/API_SignUp.html
'AWS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[AWS] AWS IoT ๋๋ฐ์ด์ค ์ญ์ ์ ์ฐจ ์ฝ๋๋ก ์์๋ณด๊ธฐ (0) | 2024.12.13 |
---|---|
[AWS] AWS IoT ๋๋ฐ์ด์ค ๋ฑ๋ก ์ ์ฐจ ์ฝ๋๋ก ์์๋ณด๊ธฐ (0) | 2024.11.29 |
[AWS] AWS SDK๋ฅผ ํ์ฉํด AWS IoT ๋๋ฐ์ด์ค ๋ฑ๋กํ๊ธฐ (0) | 2024.11.26 |
[AWS] AWS IoT Core ์ด๊ฒ์ ๊ฒ (1) | 2024.11.21 |
[AWS] AWS Cognito์ OAuth (3) | 2024.10.28 |