from zero to hero with rest and oauth2 #jjug
TRANSCRIPT
![Page 1: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/1.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved. ‹#›© 2016 Pivotal Software, Inc. All rights reserved.
From Zero to Hero with REST and OAuth2
Toshiaki Maki (@making) JJUG Night Seminar June 2016 2016-06-27
![Page 2: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/2.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Who am I ?• Toshiaki Maki (@making)
•Sr. Solutions Architect
•Spring Framework enthusiast
Perfect Java EE
(Coming Soon)
bit.ly/spring-book
![Page 3: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/3.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Spring Boot
![Page 4: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/4.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Spring Initializr https://start.spring.io/
![Page 5: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/5.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Spring Initializr https://start.spring.io/
![Page 6: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/6.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Spring Initializr https://start.spring.io/
![Page 7: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/7.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Spring Initializr https://start.spring.io/
![Page 8: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/8.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Today's topic
Web UI
Resource Server
Resource Server
Resource Server
![Page 9: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/9.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Today's topic
Web UI
Resource Server
Resource Server
Resource Server
🔐🔐🔐
![Page 10: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/10.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Today's topic
Web UI
Resource Server
Resource Server
Resource Server
🔐🔐🔐
❓
![Page 11: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/11.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Today's topic
Web UI
Resource Server
Resource Server
Resource Server
🔐🔐🔐
❓ ❓ • Basic • OAuth2 • Spring Session • SAML
![Page 12: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/12.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Today's topic
Web UI
Resource Server
Resource Server
Resource Server
🔐🔐🔐
❓ ❓ • Basic • OAuth2 • Spring Session • SAML
👈
![Page 13: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/13.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Today's topic
Authorization Server
Web UI
Resource Server
OAuth2
REST API + Access Token + SSO
![Page 14: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/14.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Live Coding!!•Spring Data REST
•Spring Security OAuth2
•@EnableAuthorizationServer
•@EnableResourceServer
•@EnableOAuth2Sso
• JWT
• Zuul Integration
![Page 15: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/15.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
OAuth2
![Page 16: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/16.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
OAuth2 - Terminologies •Resource Owner •Client •Authorization Server •Resource Server
![Page 17: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/17.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Server
CUI
Resource Server
Resource Owner Password Credentials (grant_type=password)
![Page 18: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/18.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Server
CUI
Resource Server
username & password
Resource Owner Password Credentials (grant_type=password)
![Page 19: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/19.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Server
CUI
Resource Server
username & password
token
Resource Owner Password Credentials (grant_type=password)
![Page 20: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/20.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Server
CUI
Resource Server
username & password
token
token
Resource Owner Password Credentials (grant_type=password)
![Page 21: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/21.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Server
CUI
Resource Server
username & password
token
token
response
Resource Owner Password Credentials (grant_type=password)
![Page 22: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/22.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Code (grant_type=authorization_code)
Authorization Server
Web UI
Resource Server
![Page 23: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/23.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Code (grant_type=authorization_code)
Authorization Server
Web UI
Resource Server
authorize
![Page 24: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/24.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Code (grant_type=authorization_code)
Authorization Server
Web UI
Resource Server
authorize
redirect
![Page 25: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/25.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Code (grant_type=authorization_code)
Authorization Server
Web UI
Resource Server
authorize
redirect
code
![Page 26: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/26.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Code (grant_type=authorization_code)
Authorization Server
Web UI
Resource Server
authorize
redirect
codecode
![Page 27: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/27.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Code (grant_type=authorization_code)
Authorization Server
Web UI
Resource Server
authorize
redirect
codecode
token
![Page 28: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/28.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Code (grant_type=authorization_code)
Authorization Server
Web UI
Resource Server
authorize
redirect
codecode
token
token
![Page 29: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/29.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Code (grant_type=authorization_code)
Authorization Server
Web UI
Resource Server
authorize
redirect
codecode
token
token
response
![Page 30: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/30.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Server
Web UI
Resource Server
OAuth2
REST API + Access Token
![Page 31: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/31.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Server
Web UI
Resource Server
OAuth2
REST API + Access Token
userinfo
![Page 32: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/32.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Authorization Server
Web UI
Resource Server
OAuth2
REST API + Access Token
userinfo
every time
![Page 33: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/33.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
JWT
Authorization Server
Web UI
Resource Server
OAuth2
REST API + Access Token (JWT)
![Page 34: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/34.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
JWT
Authorization Server
Web UI
Resource Server
OAuth2
REST API + Access Token (JWT)
token_key
![Page 35: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/35.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
JWT
Authorization Server
Web UI
Resource Server
OAuth2
REST API + Access Token (JWT)
token_key
at startup
![Page 36: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/36.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
JWT
Authorization Server
Web UI
Resource Server
OAuth2
REST API + Access Token (JWT)
token_key
at startup
Verify token
![Page 37: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/37.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Links• https://github.com/Pivotal-Japan/from-zero-to-hero-with-rest-
and-oauth2
• http://www.slideshare.net/WillTran1/securing-microservices-with-spring-cloud-security
![Page 38: From Zero to Hero with REST and OAuth2 #jjug](https://reader031.vdocuments.us/reader031/viewer/2022021919/586f86191a28ab54768b540b/html5/thumbnails/38.jpg)
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Announce• Josh Long(@starbuxman) comes to Tokyo on July 6th !!
https://jsug.doorkeeper.jp/events/47900