Upload
aws-korea-usergroup-aws
View
259
Download
13
Embed Size (px)
Citation preview
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
이재일, ZIPBROTHERS
Cognito 와 함께 Serverless를손쉽게 사용자 인증 구현하기
안녕하세요.
저는 이재일 입니다.
어느 작은 스타트업의 CTO
(초보 테크 오퍼레이터)입니다.
현재 여자친구는 1년 째
본 강연에서 다룰 내용
What is Cognito?
Cognito User Pool ( Identity Provider )
Cognito Federated Identity
Why Cognito?
Cognito 자격증명이 적용된 Serverless
Conclusion
What is Cognito?
What is Cognito?
1
23
What is Cognito?
Federated
Identities
Cognito
User
Pool
What is Cognito?
Cognito User Pool
Cognito Federated Identity
Congito 는 사용자 통합 인증 플랫폼
{
What is Cognito?
IAM Role
Temporary Permitted Session
User 식별, 통합
Login Provider 인증
임시권한 발급
Cognito User Pool
Cognito Federated Identity
Cognito User Pool 101
3rd party Identity Provider 를 거치지 않고, 클릭 몇 번으로 자기 서비스만의 사용자관리풀을 구축할 수 있음.
User Attributes는 커스터마이징 가능.
상기 항목들을 기본 Attribute로 제공.
Password는 AWS가 안전하게 관리.
Password Rule 지정 가능. Regexr 을 이용한 Rule 지정은 불가능.
관리자에 의한 계정이 생성되고, 한번도 사용 되지 않은 채 방치될 경우 해당 계정을 삭제함.
MFA 를 지원함. (Email, SMS Dual)
체크한 항목으로 Verification 을 강제함.
{####} 이 인증코드로 치환됨.
Web Console의 버그-> 한글 입력이 불가능.-> CLI나 SDK를 이용하면 됨.
User Pool 로그인 시 발급되는 Refresh Token 의 만료 주기. 자동로그인에 사용.
JavaScript, Python SDK에서 버그 이슈 있음.
Android, iOS SDK 이외의 경우 SRP 알고리즘에 버그 존재. 타언어 SDK는 사용 불가.
Lambda Trigger와 연계됨.
User Pool
App(Client)
App(Client)
UserN..UserN..UserN..UserN..
UserN..UserN..UserN..UserN..
AttrA, AttrC, AttrH
AttrA, AttrB, AttrD
App(Client) 마다 다른 Attributes Permission 지정 가능
User Pool
App(Client)
App(Client)
UserN..UserN..UserN..UserN..
UserN..UserN..UserN..UserN..
AttrA, AttrC, AttrH
AttrA, AttrB, AttrD
Group1
Group2
모든 User 는 여러 그룹에 소속될 수 있음.
User Pool
App(Client)
App(Client)
UserN..UserN..UserN..UserN..
UserN..UserN..UserN..UserN..
AttrA, AttrC, AttrH
AttrA, AttrB, AttrD
Group1
Group2
Use Case - 사내 동호회 회원관리
볼스주식회사
영업팀
개발팀
(각각다른 Attrs)
(각각다른 Attrs)
테니스동호회
야구동호회
User Pool Lambda Trigger
• Pre sign-up
• Post Confirmation
• Custom message
• Pre authentication
• Post authentication
• Define Auth Challenge
• Create Auth Challenge
• Verify Auth Challenge
User UserPool
sign_up()
confirm_user()
initiate_auth()
auth_challenge()
respond_to_auth_challenge()
verify_auth_challenge()
Cognito Federated Identity 101
클릭 몇 번으로 3rd party Identity Provider 는 물론 User Pool을 이용해 생성한 Identity Provider 와 연동 가능. 통합 사용자 관리가 매우 편리함.
IAM RoleTemporary Permitted Session
해당 provider와 연결된 Identity 반환신규 -> Identity 생성 후 반환
STS로부터 임시권한발급
Federated Identity
Identity Id
User Pool
1. sign_up()
2. confirm()
Federated Identities
3. get_id()
4. validate()
5. return_identity()
6. AssumeRoleWithCredentials()IAM Role
7. create_sts_session_with_IAM_Role()8. return permitted session()
Identity Provider + Federated Identities Flow
Then, WHY Cognito?
Then, WHY Cognito?
아주 쉬운 사용자 풀 생성, 관리( 사용자풀 구축을 위한 시스템 엔지니어링, 코딩이 거의필요없음)
Third-party Identity Provider Federation 용이
Then, WHY Cognito?
임시 자격 증명(STS)을 이용한 AWS 리소스 연계 및 정밀한 접근권한 관리 가능
Then, WHY Cognito?
User Pool
App(Client)
App(Client)
UserN..UserN..UserN..UserN..
UserN..UserN..UserN..UserN..
AttrA, AttrC, AttrH
AttrA, AttrB, AttrD
FederatedIdentities
IdentityN…IdentityN…IdentityN…IdentityN…IdentityN…IdentityN…IdentityN…IdentityN…
…
Default IAM Role
Custom IAM Role
Unauthorized IAM Role
[IDP] -link-[IDP] -link-[IDP] -link-
( Unauthorized IdentityN…)
사용자 정보 유출 위험 감소 ( 사용자 정보 보관의 주체가AWS )
Then, WHY Cognito?
Information Leak
Cognito 자격증명이 적용된Serverless
DEMO
Cognito S3
DynamoDBLambda
AWS JS
SDK
DEMO
API Gateway
Cognito + AWS JS SDK + S3 을 이용한 서버리스 포토갤러리
DEMO
사용자가 늘어난다 -> Cognito가 알아서 할 일이다.
새로운 사용자 모델 -> Cognito UserPool에서 App Client 하나 추가
같은 계정으로 새로운 서비스 -> Cognito UserPool 생성 후Federation
* 트래픽 부하가 늘어난다 -> Lambda 가 많이 켜진다.
(Python Serverless Deployment Using Zappa )
데이터베이스 IOPS 증가 -> DynamoDB Provising 상향
파일 업/다운로드 트래픽 -> 임시자격증명과 SDK로 Client-S3.
Direct
Conclusion
Conclusion
AWS Cognito 는 사용자 관리와 관련시스템 엔지니어링고민을 머릿속에서 지우게 해주는 아주 좋은 사용자 인증솔루션
Serverless 와 궁합이 잘 맞다!
활성 사용자 (MAU) 수가 많아질 경우 부담되는 가격이 흠.-> 프로젝트성 서비스 개발에 매우 적합.
No Cost, Fast Dev, Stable Infra.
STS 임시 자격증명을 이용해 부하분산을 고객의 Device에게!?
본 강연이 끝난 후…
http://docs.aws.amazon.com/cognito/latest/developerguide/what-is-amazon-cognito.html
https://github.com/aws/amazon-cognito-identity-js
https://blog.rackspace.com/part-2-building-serverless-architecture-aws
https://github.com/Miserlou/Zappa
https://aws.amazon.com/ko/blogs/mobile/integrating-amazon-cognito-user-pools-with-api-gateway/
@awskrug
#AWSKRUG 해시태그로 소셜 미디어에여러분의 행사 소감을 올려주세요.
Thank you.