SlideShare ist ein Scribd-Unternehmen logo
1 von 49
Downloaden Sie, um offline zu lesen
Next Generation
Spring Security OAuth 2.0
Spring Security OAuth 2.0 Contribution경험 공유
PaaS 이명현
오늘 이야기할 키워드
• Spring Security OAuth 2.0 로드 맵
• OAuth 2.0 Authorization Code Grant Flow
• Spring OAuth 2.0 support projects 비교
• Contribution 경험 공유
Spring OAuth 2.0 Support,
within the Spring projects portfolio
• spring-security-oauth
https://github.com/spring-projects/spring-security-oauth
• spring-security-oauth2-boot (support for spring boot 1.5.x)
https://github.com/spring-projects/spring-security-oauth2-boot
• spring-cloud-security
https://github.com/spring-cloud/spring-cloud-security
• spring-security
https://github.com/spring-projects/spring-security
• spring-social
https://github.com/spring-projects/spring-social
• spring-social
• 4 Main Projects
• 2 Incubator Projects
• 35 Community Projects
“Why has Spring Security 5 introduced new support into the mix?”
“Which project(s) do I use?”
• OAuth 2.0 지원을 하나의 프로젝트로 통합할 필요가 있다.
• OAuth 2.0 확장 스펙을 지원할 수 있어야 한다.
- OAuth2 Assertions (RFC-7521) , SAML2 Bearer Assertion (RFC-7522) , JWT Bearer Assertion (RFC-7523)
• OpenID Connect 1.0 / JOSE 스펙을 지원한다.
• 커뮤니티 피드백을 기반으로 사용 편의성을 개선한다.
• Documentation 을 자세히 제공할 필요가 있다.
Next Generation OAuth 2.0 Goal
• spring-security-oauth2-client : 5.0.0 (2017.11)
• spring-security-oauth2-jose : 5.0.0 (2017.11)
• spring-security-oauth2-resource-server : 5.1.0 (2018.09 예정)
• spring-security-oauth2-authorization-server: (2019 초 예정)
The Plan Forward
OAuth 2.0 Authorization Code Grant Flow
혹시 OAuth 2.0 Flow 를 모르시는 분들을 위해….
그림. Pivotal Documentation Single Sign-On
https://docs.pivotal.io/p-identity/1-6/configure-apps/web-app.html
그래서 뭐가 다른건데?
* spring-security-oauth
• spring-security-oauth
- OAuth 1.0 support
• spring-security-oauth2
- OAuth 2.0 support
- @EnableOAuth2Client
- @EnableAuthorizationServer
- @EnableResourceServer
• spring-security-jwt
- OAuth 2.0 JWT support
- Jwt, JwtAlgorithms, Sign, Encryption
* spring-security-oauth2-boot (support for spring boot 1.5.x)
+ Spring Boot properties base AutoConfiguration
+ @EnableOAuth2Sso
+ UserInfoTokenService
+ Spring Social support
+ Customizers
- JwtAccessTokenConverterRestTemplateCustomizer
- UserInfoRestTemplateCustomizer
- PrincipalExtractor
- AuthoritiesExtractor
* spring-cloud-security
+ AccessTokenContextRelay
+ OAuth2LoadBalancerClient (UserInfo)
+ OAuth2FeignRequestInterceptor
+ OAuth2TokenRelayFilter (ZuulFilter)
- proxy.auth.routes.{service-name}: oauth2 # OAuth2 인증 후 AccessToken 을 서비스에 전달
- proxy.auth.routes.{service-name}: passthru # Authorization header 를 그대로 서비스에 전달
- proxy.auth.routes.{service-name}: none # Authorization header 를 제거한 후 서비스에 전달
* OAuth2TokenRelayFilter
1. AccessToken
2. Authenticate / Refresh
3. AccessToken
proxy.auth.routes.{service-name}: oauth2
4. User Resource
1. AccessToken
3. Authenticate / Refresh
2. AccessToken
* OAuth2TokenRelayFilter
proxy.auth.routes.{service-name}: passthru
4. User Resource
* spring-social
• social API SDK 제공 (facebook, twitter, linkedin ..)
• 각 social 별 인증 방식 최적화 및 API 구현
• Spring Boot 1.5.x 에서 spring security oauth 와 연동
지원 (SpringSocialTokenServices)
• Projects in the Attic 으로 밀려나면서 업데이트 거의 없
음 (2017.11 이후 커밋 거의 없음)
• spring-social-facebook deprecated 된 버전 지원 중
Next Generation Spring Security OAuth 2.0
spring security 5.x
* spring-security 5.x oauth2 (client)
- multi tenant support
- registration 과 provider 의 설정 분리
* spring-security 5.x oauth2 (client)
- CommonOAuth2Provider
- GOOGLE, GITHUB, FACEBOOK, OKTA
* spring-security 5.x oauth2 (client)
- spring security fluent java config API
- more extensive configuration
* spring-security 5.x oauth2 (client, jose)
- OIDC (OpenID Connect 1.0) support / Okta
- Nimbus JOSE + JWT
- Nimbus OAuth 2.0 SDK
* spring-security 5.x oauth2 (resource-server 진행 중)
- BearerTokenAuthenticationFilter
- BearerTokenAuthenticationToken
- BearerTokenResolver
- JwtAuthenticationToken
- JwtAuthenticationProvider
* spring-security 5.x oauth2
- Spring Boot 2.x OAuth 2.0 기본 모듈로 지정
- Spring Web-Flux Reactive Support
Spring Security 5.x OAuth 2.0 으로 Migration 도전
1. spring-security-oauth 프로젝트는 maintenance mode 로 변경
2. spring-boot 2.x 에서 spring security 5.x oauth2를 기본 모듈로 지원
3. spring-security-oauth 에서 삽질 및 고생을 많이 함..
4. spring security 5.x oauth2 의 인터페이스 설계가 괜찮아 보임
왜?
spring-security-oauth 에 함께 고통 받고 있는 개발자들….
spring-security-oauth 에 고통 받는 이유
1. spring-security 도 어려운데 spring-security-oauth는 더 어려움
2. client, authorization-server, resource-server 의 설정 경계가 모호함
3. 어노테이션 기반의 설정은 기본적인 프로세스만 제공
4. 실제 서비스에서는 다양하고 복잡한 처리가 요구됨
5. 확장 포인트가 적절히 오픈 되어 있지 않다.
6. SSO, Customizer 등은 boot 프로젝트에 위치하고, 충분치 않음.
7. 결국 직접 상속/Override 하여, 재구성 (이럴바엔 직접 구현하는게 나을지도..)
spring security 5.0.0 oauth 2.0
1. client registration, provider 의 설정 구분이 명확함.
2. 확장이 필요한 기능 인터페이스와 Java Config 제공.
3. Redirect 와 Authentication프로세스가 분리 관리됨.
4. 디테일한 포인트에 확장이 아직 제공되지 않음.
5. 아직 구현되지 않은 Spec 이 많음.
6. AuthorizationServer, ResourceServer 는 아직 개발되지 않음.
7. 버그가 심심찮게 나옴
8. 개선했어도 어렵다. (spring security, OAuth 2.0 스펙 본연의 복잡함)
9. Migration 실패
5.1.0 적용 목표로 필요 기능 Contribution 하기
Contribution 1. Java Config NPE bug fix
- Java Config 에서 loginProcissingUrl 설정 시 NPE bug fix
https://github.com/spring-projects/spring-security/pull/5489
Contribution 2. OAuth2AccessToken serialize exception fix
- OAuth2AccessToken 을 serialize 할 때 exception 이 발생하는 bug fix
https://github.com/spring-projects/spring-security/pull/5493
Contribution 3. ClientRegistration scope can be null.
- ClientRegistration 설정 시 scope 이 null 값이 될 수 있도록 수정 (RFC-6749)
https://github.com/spring-projects/spring-security/pull/5495
Contribution 4/5. baseUrl exclude queryString
- RequestUri 기반으로 baseUrl 을 추출할 때 requestUri 에서 queryString 제거
https://github.com/spring-projects/spring-security/pull/5522
https://github.com/spring-projects/spring-security/pull/5559
Contribution 6. Polish Javadoc to remove warning
https://github.com/spring-projects/spring-security/pull/5505
Contribution 7. Authenticated Request Methods (RFC-6750)
https://github.com/spring-projects/spring-security/pull/5501
Contribution 8. spring boot configuration
https://github.com/spring-projects/spring-boot/pull/13865
Issue and Solution : Support X-Forwarded-* Header
https://github.com/spring-projects/spring-security/issues/5535
Issue and Solution : PrincipalExtractor for username
https://github.com/spring-projects/spring-security/issues/5526
Issue and Solution : OAuth2AuthorizationRequestResolver Customizer
https://github.com/spring-projects/spring-security/issues/5525
Reject but apply later :
Refactor OAuth2AuthorizationRequestResolver interface api
https://github.com/spring-projects/spring-security/issues/5554
Reject Apply later
- 5.1.0-SNAPSHOT 기준으로 마이그레이션 성공
- 5.1.0-RELEASE 발표되면, 운영 중인 실 서비스 전환 예정 (2018.09.21예정)
Spring 기반의 OAuth 2.0 구현을 준비한다면…
1. spring-social 은 선택하지 않기를 권장.
2. AuthorizationServer, ResourceServer 는 spring security 5.x 현재 미구현.
3. AuthorizationServer, ResourceServer 까지 구현/안정화되면전환을 권장.
4. spring security 5.1.0 에서 개선이 많이 됐기에, Client 모듈 적용도 괜찮을 듯.
5. GOOGLE, FACEBOOK 로그인은 간편 설정 연동 가능. (CommonOAuth2Provider)
6. 아직 과도기에 미구현 스펙(RFC)이 많기 때문에, Contribution 을 도전해볼 수 있음.
7. 어느것도 학습 비용이 높기 때문에, 직접 구현하는 것도 방법.
Appendix
Appendix. Web-Flux 지원으로 비슷한 코드가 2벌로 존재
- OAuth2AuthorizedClientService
- ReactiveOAuth2AuthorizedClientService
- OAuth2UserService
- ReactiveOAuth2UserService
- ClientRegistrationRepository
- ReactiveClientRegistrationRepository
- OidcUserService
- OidcReactiveOAuth2UserService
- OAuth2AccessTokenResponseClient
- ReactiveOAuth2AccessTokenResponseClient
Appendix. 상속보다 Composition 확장 선호
Appendix. 불변 객체 선호
- DefaultOAuth2AuthorizationRequestResolver
- OAuth2AuthorizationRequest
- OAuth2AuthorizationResponse
- OAuth2AccessTokenResponse
- OAuth2AccessToken
- OAuth2RefreshToken
- Jwt
-OAuth2UserRequest
-OidcUserService
-OidcUserRequest
-DefaultOAuth2User
-DefaultOidcUser
-OidcIdToken
-OidcUserInfo
-OAuth2AuthorizedClient
-OAuth2Error
Appendix. @RegisteredOAuth2AuthorizedClient (5.1.0)
끝

Weitere ähnliche Inhalte

Was ist angesagt?

NginxとLuaを用いた動的なリバースプロキシでデプロイを 100 倍速くした
NginxとLuaを用いた動的なリバースプロキシでデプロイを 100 倍速くしたNginxとLuaを用いた動的なリバースプロキシでデプロイを 100 倍速くした
NginxとLuaを用いた動的なリバースプロキシでデプロイを 100 倍速くした
toshi_pp
 

Was ist angesagt? (20)

CCIS Chapter 6 Openstack new.pptx
CCIS  Chapter  6  Openstack new.pptxCCIS  Chapter  6  Openstack new.pptx
CCIS Chapter 6 Openstack new.pptx
 
semaphore & mutex.pdf
semaphore & mutex.pdfsemaphore & mutex.pdf
semaphore & mutex.pdf
 
NginxとLuaを用いた動的なリバースプロキシでデプロイを 100 倍速くした
NginxとLuaを用いた動的なリバースプロキシでデプロイを 100 倍速くしたNginxとLuaを用いた動的なリバースプロキシでデプロイを 100 倍速くした
NginxとLuaを用いた動的なリバースプロキシでデプロイを 100 倍速くした
 
[오픈소스컨설팅]오픈소스메일시스템
[오픈소스컨설팅]오픈소스메일시스템[오픈소스컨설팅]오픈소스메일시스템
[오픈소스컨설팅]오픈소스메일시스템
 
Fault Tolerance 소프트웨어 패턴
Fault Tolerance 소프트웨어 패턴Fault Tolerance 소프트웨어 패턴
Fault Tolerance 소프트웨어 패턴
 
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - DevO...
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - DevO...Running Kubernetes in Production: A Million Ways to Crash Your Cluster - DevO...
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - DevO...
 
쿠버네티스의 이해 #1
쿠버네티스의 이해 #1쿠버네티스의 이해 #1
쿠버네티스의 이해 #1
 
捕鯨!詳解docker
捕鯨!詳解docker捕鯨!詳解docker
捕鯨!詳解docker
 
Coffee Break NeuVector
Coffee Break NeuVectorCoffee Break NeuVector
Coffee Break NeuVector
 
소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안
소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안
소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안
 
[오픈소스컨설팅]오픈스택에 대하여
[오픈소스컨설팅]오픈스택에 대하여[오픈소스컨설팅]오픈스택에 대하여
[오픈소스컨설팅]오픈스택에 대하여
 
Kubernetes Controller for Pull Request Based Environment
Kubernetes Controller for Pull Request Based EnvironmentKubernetes Controller for Pull Request Based Environment
Kubernetes Controller for Pull Request Based Environment
 
Openstack live migration
Openstack live migrationOpenstack live migration
Openstack live migration
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
 
AKS - Azure Kubernetes Services - kubernetes meetup may 2018
AKS - Azure Kubernetes Services  - kubernetes meetup may 2018AKS - Azure Kubernetes Services  - kubernetes meetup may 2018
AKS - Azure Kubernetes Services - kubernetes meetup may 2018
 
Docker, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
 
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
 
Understanding Kubernetes
Understanding KubernetesUnderstanding Kubernetes
Understanding Kubernetes
 
MicroK8s
MicroK8sMicroK8s
MicroK8s
 
[Cloud OnAir] Config Connector の特徴と、 Anthos Config Management を 組み合わせた、 構成管理の...
[Cloud OnAir] Config Connector の特徴と、 Anthos Config Management を 組み合わせた、 構成管理の...[Cloud OnAir] Config Connector の特徴と、 Anthos Config Management を 組み合わせた、 構成管理の...
[Cloud OnAir] Config Connector の特徴と、 Anthos Config Management を 組み合わせた、 構成管理の...
 

Ähnlich wie [네이버오픈소스세미나] Next Generation Spring Security OAuth2.0 - 이명현

How to contribute at OpenStack
How to contribute at OpenStackHow to contribute at OpenStack
How to contribute at OpenStack
SK Telecom
 
소셜 네트워크 앱 개발
소셜 네트워크 앱 개발소셜 네트워크 앱 개발
소셜 네트워크 앱 개발
Kenu, GwangNam Heo
 
Open standard open cloud engine (3)
Open standard open cloud engine (3)Open standard open cloud engine (3)
Open standard open cloud engine (3)
uEngine Solutions
 

Ähnlich wie [네이버오픈소스세미나] Next Generation Spring Security OAuth2.0 - 이명현 (20)

Spring one참석기 ksug
Spring one참석기 ksugSpring one참석기 ksug
Spring one참석기 ksug
 
Meetup tools for-cloud_native_apps_meetup20180510-vs
Meetup tools for-cloud_native_apps_meetup20180510-vsMeetup tools for-cloud_native_apps_meetup20180510-vs
Meetup tools for-cloud_native_apps_meetup20180510-vs
 
[개방형 클라우드 플랫폼 오픈세미나 오픈클라우드 Pub] 3.open shift 분석
[개방형 클라우드 플랫폼 오픈세미나 오픈클라우드 Pub] 3.open shift 분석[개방형 클라우드 플랫폼 오픈세미나 오픈클라우드 Pub] 3.open shift 분석
[개방형 클라우드 플랫폼 오픈세미나 오픈클라우드 Pub] 3.open shift 분석
 
How to contribute at OpenStack
How to contribute at OpenStackHow to contribute at OpenStack
How to contribute at OpenStack
 
소셜 네트워크 앱 개발
소셜 네트워크 앱 개발소셜 네트워크 앱 개발
소셜 네트워크 앱 개발
 
Spring Boot 기초 코드랩 (2019-10-26)
Spring Boot 기초 코드랩 (2019-10-26)Spring Boot 기초 코드랩 (2019-10-26)
Spring Boot 기초 코드랩 (2019-10-26)
 
Private PaaS with Docker, spring cloud and mesos
Private PaaS with Docker, spring cloud and mesos Private PaaS with Docker, spring cloud and mesos
Private PaaS with Docker, spring cloud and mesos
 
2022.08 멘토링 자료.pptx
2022.08 멘토링 자료.pptx2022.08 멘토링 자료.pptx
2022.08 멘토링 자료.pptx
 
DevOps - CI/CD 알아보기
DevOps - CI/CD 알아보기DevOps - CI/CD 알아보기
DevOps - CI/CD 알아보기
 
Atlassian JIRA Plugin 및 REST API를 이용한 기능 확장
Atlassian JIRA Plugin 및 REST API를 이용한 기능 확장Atlassian JIRA Plugin 및 REST API를 이용한 기능 확장
Atlassian JIRA Plugin 및 REST API를 이용한 기능 확장
 
Deview 2013 :: Backend PaaS, CloudFoundry 뽀개기
Deview 2013 :: Backend PaaS, CloudFoundry 뽀개기Deview 2013 :: Backend PaaS, CloudFoundry 뽀개기
Deview 2013 :: Backend PaaS, CloudFoundry 뽀개기
 
Spring Project와 최신 Pivotal Cloud Foundry 업데이트
Spring Project와 최신 Pivotal Cloud Foundry 업데이트 Spring Project와 최신 Pivotal Cloud Foundry 업데이트
Spring Project와 최신 Pivotal Cloud Foundry 업데이트
 
Internship backend
Internship backendInternship backend
Internship backend
 
텔레그램을 이용한 양방향 모니터링 시스템 구축
텔레그램을 이용한 양방향 모니터링 시스템 구축텔레그램을 이용한 양방향 모니터링 시스템 구축
텔레그램을 이용한 양방향 모니터링 시스템 구축
 
Pivotal Cloud Foundry(PCF) 2.0 and Pivotal Container Service ( PKS ) 신혜원
Pivotal Cloud Foundry(PCF) 2.0 and Pivotal Container Service ( PKS ) 신혜원Pivotal Cloud Foundry(PCF) 2.0 and Pivotal Container Service ( PKS ) 신혜원
Pivotal Cloud Foundry(PCF) 2.0 and Pivotal Container Service ( PKS ) 신혜원
 
[MeetUp][3rd] Prometheus 와 함께하는 모니터링 및 시각화
[MeetUp][3rd] Prometheus 와 함께하는 모니터링 및 시각화[MeetUp][3rd] Prometheus 와 함께하는 모니터링 및 시각화
[MeetUp][3rd] Prometheus 와 함께하는 모니터링 및 시각화
 
okspring3x
okspring3xokspring3x
okspring3x
 
Cms All 091103
Cms All 091103Cms All 091103
Cms All 091103
 
Open standard open cloud engine (3)
Open standard open cloud engine (3)Open standard open cloud engine (3)
Open standard open cloud engine (3)
 
Spring boot DI
Spring boot DISpring boot DI
Spring boot DI
 

Mehr von NAVER Engineering

Mehr von NAVER Engineering (20)

React vac pattern
React vac patternReact vac pattern
React vac pattern
 
디자인 시스템에 직방 ZUIX
디자인 시스템에 직방 ZUIX디자인 시스템에 직방 ZUIX
디자인 시스템에 직방 ZUIX
 
진화하는 디자인 시스템(걸음마 편)
진화하는 디자인 시스템(걸음마 편)진화하는 디자인 시스템(걸음마 편)
진화하는 디자인 시스템(걸음마 편)
 
서비스 운영을 위한 디자인시스템 프로젝트
서비스 운영을 위한 디자인시스템 프로젝트서비스 운영을 위한 디자인시스템 프로젝트
서비스 운영을 위한 디자인시스템 프로젝트
 
BPL(Banksalad Product Language) 무야호
BPL(Banksalad Product Language) 무야호BPL(Banksalad Product Language) 무야호
BPL(Banksalad Product Language) 무야호
 
이번 생에 디자인 시스템은 처음이라
이번 생에 디자인 시스템은 처음이라이번 생에 디자인 시스템은 처음이라
이번 생에 디자인 시스템은 처음이라
 
날고 있는 여러 비행기 넘나 들며 정비하기
날고 있는 여러 비행기 넘나 들며 정비하기날고 있는 여러 비행기 넘나 들며 정비하기
날고 있는 여러 비행기 넘나 들며 정비하기
 
쏘카프레임 구축 배경과 과정
 쏘카프레임 구축 배경과 과정 쏘카프레임 구축 배경과 과정
쏘카프레임 구축 배경과 과정
 
플랫폼 디자이너 없이 디자인 시스템을 구축하는 프로덕트 디자이너의 우당탕탕 고통 연대기
플랫폼 디자이너 없이 디자인 시스템을 구축하는 프로덕트 디자이너의 우당탕탕 고통 연대기플랫폼 디자이너 없이 디자인 시스템을 구축하는 프로덕트 디자이너의 우당탕탕 고통 연대기
플랫폼 디자이너 없이 디자인 시스템을 구축하는 프로덕트 디자이너의 우당탕탕 고통 연대기
 
200820 NAVER TECH CONCERT 15_Code Review is Horse(코드리뷰는 말이야)(feat.Latte)
200820 NAVER TECH CONCERT 15_Code Review is Horse(코드리뷰는 말이야)(feat.Latte)200820 NAVER TECH CONCERT 15_Code Review is Horse(코드리뷰는 말이야)(feat.Latte)
200820 NAVER TECH CONCERT 15_Code Review is Horse(코드리뷰는 말이야)(feat.Latte)
 
200819 NAVER TECH CONCERT 03_화려한 코루틴이 내 앱을 감싸네! 코루틴으로 작성해보는 깔끔한 비동기 코드
200819 NAVER TECH CONCERT 03_화려한 코루틴이 내 앱을 감싸네! 코루틴으로 작성해보는 깔끔한 비동기 코드200819 NAVER TECH CONCERT 03_화려한 코루틴이 내 앱을 감싸네! 코루틴으로 작성해보는 깔끔한 비동기 코드
200819 NAVER TECH CONCERT 03_화려한 코루틴이 내 앱을 감싸네! 코루틴으로 작성해보는 깔끔한 비동기 코드
 
200819 NAVER TECH CONCERT 10_맥북에서도 아이맥프로에서 빌드하는 것처럼 빌드 속도 빠르게 하기
200819 NAVER TECH CONCERT 10_맥북에서도 아이맥프로에서 빌드하는 것처럼 빌드 속도 빠르게 하기200819 NAVER TECH CONCERT 10_맥북에서도 아이맥프로에서 빌드하는 것처럼 빌드 속도 빠르게 하기
200819 NAVER TECH CONCERT 10_맥북에서도 아이맥프로에서 빌드하는 것처럼 빌드 속도 빠르게 하기
 
200819 NAVER TECH CONCERT 08_성능을 고민하는 슬기로운 개발자 생활
200819 NAVER TECH CONCERT 08_성능을 고민하는 슬기로운 개발자 생활200819 NAVER TECH CONCERT 08_성능을 고민하는 슬기로운 개발자 생활
200819 NAVER TECH CONCERT 08_성능을 고민하는 슬기로운 개발자 생활
 
200819 NAVER TECH CONCERT 05_모르면 손해보는 Android 디버깅/분석 꿀팁 대방출
200819 NAVER TECH CONCERT 05_모르면 손해보는 Android 디버깅/분석 꿀팁 대방출200819 NAVER TECH CONCERT 05_모르면 손해보는 Android 디버깅/분석 꿀팁 대방출
200819 NAVER TECH CONCERT 05_모르면 손해보는 Android 디버깅/분석 꿀팁 대방출
 
200819 NAVER TECH CONCERT 09_Case.xcodeproj - 좋은 동료로 거듭나기 위한 노하우
200819 NAVER TECH CONCERT 09_Case.xcodeproj - 좋은 동료로 거듭나기 위한 노하우200819 NAVER TECH CONCERT 09_Case.xcodeproj - 좋은 동료로 거듭나기 위한 노하우
200819 NAVER TECH CONCERT 09_Case.xcodeproj - 좋은 동료로 거듭나기 위한 노하우
 
200820 NAVER TECH CONCERT 14_야 너두 할 수 있어. 비전공자, COBOL 개발자를 거쳐 네이버에서 FE 개발하게 된...
200820 NAVER TECH CONCERT 14_야 너두 할 수 있어. 비전공자, COBOL 개발자를 거쳐 네이버에서 FE 개발하게 된...200820 NAVER TECH CONCERT 14_야 너두 할 수 있어. 비전공자, COBOL 개발자를 거쳐 네이버에서 FE 개발하게 된...
200820 NAVER TECH CONCERT 14_야 너두 할 수 있어. 비전공자, COBOL 개발자를 거쳐 네이버에서 FE 개발하게 된...
 
200820 NAVER TECH CONCERT 13_네이버에서 오픈 소스 개발을 통해 성장하는 방법
200820 NAVER TECH CONCERT 13_네이버에서 오픈 소스 개발을 통해 성장하는 방법200820 NAVER TECH CONCERT 13_네이버에서 오픈 소스 개발을 통해 성장하는 방법
200820 NAVER TECH CONCERT 13_네이버에서 오픈 소스 개발을 통해 성장하는 방법
 
200820 NAVER TECH CONCERT 12_상반기 네이버 인턴을 돌아보며
200820 NAVER TECH CONCERT 12_상반기 네이버 인턴을 돌아보며200820 NAVER TECH CONCERT 12_상반기 네이버 인턴을 돌아보며
200820 NAVER TECH CONCERT 12_상반기 네이버 인턴을 돌아보며
 
200820 NAVER TECH CONCERT 11_빠르게 성장하는 슈퍼루키로 거듭나기
200820 NAVER TECH CONCERT 11_빠르게 성장하는 슈퍼루키로 거듭나기200820 NAVER TECH CONCERT 11_빠르게 성장하는 슈퍼루키로 거듭나기
200820 NAVER TECH CONCERT 11_빠르게 성장하는 슈퍼루키로 거듭나기
 
200819 NAVER TECH CONCERT 07_신입 iOS 개발자 개발업무 적응기
200819 NAVER TECH CONCERT 07_신입 iOS 개발자 개발업무 적응기200819 NAVER TECH CONCERT 07_신입 iOS 개발자 개발업무 적응기
200819 NAVER TECH CONCERT 07_신입 iOS 개발자 개발업무 적응기
 

[네이버오픈소스세미나] Next Generation Spring Security OAuth2.0 - 이명현

  • 1. Next Generation Spring Security OAuth 2.0 Spring Security OAuth 2.0 Contribution경험 공유 PaaS 이명현
  • 2. 오늘 이야기할 키워드 • Spring Security OAuth 2.0 로드 맵 • OAuth 2.0 Authorization Code Grant Flow • Spring OAuth 2.0 support projects 비교 • Contribution 경험 공유
  • 3. Spring OAuth 2.0 Support, within the Spring projects portfolio
  • 4. • spring-security-oauth https://github.com/spring-projects/spring-security-oauth • spring-security-oauth2-boot (support for spring boot 1.5.x) https://github.com/spring-projects/spring-security-oauth2-boot • spring-cloud-security https://github.com/spring-cloud/spring-cloud-security • spring-security https://github.com/spring-projects/spring-security • spring-social https://github.com/spring-projects/spring-social
  • 5. • spring-social • 4 Main Projects • 2 Incubator Projects • 35 Community Projects
  • 6. “Why has Spring Security 5 introduced new support into the mix?” “Which project(s) do I use?”
  • 7. • OAuth 2.0 지원을 하나의 프로젝트로 통합할 필요가 있다. • OAuth 2.0 확장 스펙을 지원할 수 있어야 한다. - OAuth2 Assertions (RFC-7521) , SAML2 Bearer Assertion (RFC-7522) , JWT Bearer Assertion (RFC-7523) • OpenID Connect 1.0 / JOSE 스펙을 지원한다. • 커뮤니티 피드백을 기반으로 사용 편의성을 개선한다. • Documentation 을 자세히 제공할 필요가 있다. Next Generation OAuth 2.0 Goal
  • 8. • spring-security-oauth2-client : 5.0.0 (2017.11) • spring-security-oauth2-jose : 5.0.0 (2017.11) • spring-security-oauth2-resource-server : 5.1.0 (2018.09 예정) • spring-security-oauth2-authorization-server: (2019 초 예정) The Plan Forward
  • 9. OAuth 2.0 Authorization Code Grant Flow 혹시 OAuth 2.0 Flow 를 모르시는 분들을 위해….
  • 10. 그림. Pivotal Documentation Single Sign-On https://docs.pivotal.io/p-identity/1-6/configure-apps/web-app.html
  • 12. * spring-security-oauth • spring-security-oauth - OAuth 1.0 support • spring-security-oauth2 - OAuth 2.0 support - @EnableOAuth2Client - @EnableAuthorizationServer - @EnableResourceServer • spring-security-jwt - OAuth 2.0 JWT support - Jwt, JwtAlgorithms, Sign, Encryption
  • 13. * spring-security-oauth2-boot (support for spring boot 1.5.x) + Spring Boot properties base AutoConfiguration + @EnableOAuth2Sso + UserInfoTokenService + Spring Social support + Customizers - JwtAccessTokenConverterRestTemplateCustomizer - UserInfoRestTemplateCustomizer - PrincipalExtractor - AuthoritiesExtractor
  • 14. * spring-cloud-security + AccessTokenContextRelay + OAuth2LoadBalancerClient (UserInfo) + OAuth2FeignRequestInterceptor + OAuth2TokenRelayFilter (ZuulFilter) - proxy.auth.routes.{service-name}: oauth2 # OAuth2 인증 후 AccessToken 을 서비스에 전달 - proxy.auth.routes.{service-name}: passthru # Authorization header 를 그대로 서비스에 전달 - proxy.auth.routes.{service-name}: none # Authorization header 를 제거한 후 서비스에 전달
  • 15. * OAuth2TokenRelayFilter 1. AccessToken 2. Authenticate / Refresh 3. AccessToken proxy.auth.routes.{service-name}: oauth2 4. User Resource
  • 16. 1. AccessToken 3. Authenticate / Refresh 2. AccessToken * OAuth2TokenRelayFilter proxy.auth.routes.{service-name}: passthru 4. User Resource
  • 17. * spring-social • social API SDK 제공 (facebook, twitter, linkedin ..) • 각 social 별 인증 방식 최적화 및 API 구현 • Spring Boot 1.5.x 에서 spring security oauth 와 연동 지원 (SpringSocialTokenServices) • Projects in the Attic 으로 밀려나면서 업데이트 거의 없 음 (2017.11 이후 커밋 거의 없음) • spring-social-facebook deprecated 된 버전 지원 중
  • 18. Next Generation Spring Security OAuth 2.0 spring security 5.x
  • 19. * spring-security 5.x oauth2 (client) - multi tenant support - registration 과 provider 의 설정 분리
  • 20. * spring-security 5.x oauth2 (client) - CommonOAuth2Provider - GOOGLE, GITHUB, FACEBOOK, OKTA
  • 21. * spring-security 5.x oauth2 (client) - spring security fluent java config API - more extensive configuration
  • 22. * spring-security 5.x oauth2 (client, jose) - OIDC (OpenID Connect 1.0) support / Okta - Nimbus JOSE + JWT - Nimbus OAuth 2.0 SDK
  • 23. * spring-security 5.x oauth2 (resource-server 진행 중) - BearerTokenAuthenticationFilter - BearerTokenAuthenticationToken - BearerTokenResolver - JwtAuthenticationToken - JwtAuthenticationProvider
  • 24. * spring-security 5.x oauth2 - Spring Boot 2.x OAuth 2.0 기본 모듈로 지정 - Spring Web-Flux Reactive Support
  • 25. Spring Security 5.x OAuth 2.0 으로 Migration 도전
  • 26. 1. spring-security-oauth 프로젝트는 maintenance mode 로 변경 2. spring-boot 2.x 에서 spring security 5.x oauth2를 기본 모듈로 지원 3. spring-security-oauth 에서 삽질 및 고생을 많이 함.. 4. spring security 5.x oauth2 의 인터페이스 설계가 괜찮아 보임 왜?
  • 27. spring-security-oauth 에 함께 고통 받고 있는 개발자들….
  • 28. spring-security-oauth 에 고통 받는 이유 1. spring-security 도 어려운데 spring-security-oauth는 더 어려움 2. client, authorization-server, resource-server 의 설정 경계가 모호함 3. 어노테이션 기반의 설정은 기본적인 프로세스만 제공 4. 실제 서비스에서는 다양하고 복잡한 처리가 요구됨 5. 확장 포인트가 적절히 오픈 되어 있지 않다. 6. SSO, Customizer 등은 boot 프로젝트에 위치하고, 충분치 않음. 7. 결국 직접 상속/Override 하여, 재구성 (이럴바엔 직접 구현하는게 나을지도..)
  • 29. spring security 5.0.0 oauth 2.0 1. client registration, provider 의 설정 구분이 명확함. 2. 확장이 필요한 기능 인터페이스와 Java Config 제공. 3. Redirect 와 Authentication프로세스가 분리 관리됨. 4. 디테일한 포인트에 확장이 아직 제공되지 않음. 5. 아직 구현되지 않은 Spec 이 많음. 6. AuthorizationServer, ResourceServer 는 아직 개발되지 않음. 7. 버그가 심심찮게 나옴 8. 개선했어도 어렵다. (spring security, OAuth 2.0 스펙 본연의 복잡함) 9. Migration 실패
  • 30. 5.1.0 적용 목표로 필요 기능 Contribution 하기
  • 31. Contribution 1. Java Config NPE bug fix - Java Config 에서 loginProcissingUrl 설정 시 NPE bug fix https://github.com/spring-projects/spring-security/pull/5489
  • 32. Contribution 2. OAuth2AccessToken serialize exception fix - OAuth2AccessToken 을 serialize 할 때 exception 이 발생하는 bug fix https://github.com/spring-projects/spring-security/pull/5493
  • 33. Contribution 3. ClientRegistration scope can be null. - ClientRegistration 설정 시 scope 이 null 값이 될 수 있도록 수정 (RFC-6749) https://github.com/spring-projects/spring-security/pull/5495
  • 34. Contribution 4/5. baseUrl exclude queryString - RequestUri 기반으로 baseUrl 을 추출할 때 requestUri 에서 queryString 제거 https://github.com/spring-projects/spring-security/pull/5522 https://github.com/spring-projects/spring-security/pull/5559
  • 35. Contribution 6. Polish Javadoc to remove warning https://github.com/spring-projects/spring-security/pull/5505
  • 36. Contribution 7. Authenticated Request Methods (RFC-6750) https://github.com/spring-projects/spring-security/pull/5501
  • 37. Contribution 8. spring boot configuration https://github.com/spring-projects/spring-boot/pull/13865
  • 38. Issue and Solution : Support X-Forwarded-* Header https://github.com/spring-projects/spring-security/issues/5535
  • 39. Issue and Solution : PrincipalExtractor for username https://github.com/spring-projects/spring-security/issues/5526
  • 40. Issue and Solution : OAuth2AuthorizationRequestResolver Customizer https://github.com/spring-projects/spring-security/issues/5525
  • 41. Reject but apply later : Refactor OAuth2AuthorizationRequestResolver interface api https://github.com/spring-projects/spring-security/issues/5554 Reject Apply later
  • 42. - 5.1.0-SNAPSHOT 기준으로 마이그레이션 성공 - 5.1.0-RELEASE 발표되면, 운영 중인 실 서비스 전환 예정 (2018.09.21예정)
  • 43. Spring 기반의 OAuth 2.0 구현을 준비한다면… 1. spring-social 은 선택하지 않기를 권장. 2. AuthorizationServer, ResourceServer 는 spring security 5.x 현재 미구현. 3. AuthorizationServer, ResourceServer 까지 구현/안정화되면전환을 권장. 4. spring security 5.1.0 에서 개선이 많이 됐기에, Client 모듈 적용도 괜찮을 듯. 5. GOOGLE, FACEBOOK 로그인은 간편 설정 연동 가능. (CommonOAuth2Provider) 6. 아직 과도기에 미구현 스펙(RFC)이 많기 때문에, Contribution 을 도전해볼 수 있음. 7. 어느것도 학습 비용이 높기 때문에, 직접 구현하는 것도 방법.
  • 45. Appendix. Web-Flux 지원으로 비슷한 코드가 2벌로 존재 - OAuth2AuthorizedClientService - ReactiveOAuth2AuthorizedClientService - OAuth2UserService - ReactiveOAuth2UserService - ClientRegistrationRepository - ReactiveClientRegistrationRepository - OidcUserService - OidcReactiveOAuth2UserService - OAuth2AccessTokenResponseClient - ReactiveOAuth2AccessTokenResponseClient
  • 47. Appendix. 불변 객체 선호 - DefaultOAuth2AuthorizationRequestResolver - OAuth2AuthorizationRequest - OAuth2AuthorizationResponse - OAuth2AccessTokenResponse - OAuth2AccessToken - OAuth2RefreshToken - Jwt -OAuth2UserRequest -OidcUserService -OidcUserRequest -DefaultOAuth2User -DefaultOidcUser -OidcIdToken -OidcUserInfo -OAuth2AuthorizedClient -OAuth2Error
  • 49.