47
OAuth and OpenID Connect for Microservices A homogenous solution for a heterogeneous problem Jacob Ideskog – Identity Specialist at Twobo Technologies Copyright © 2014 Twobo Technologies AB. All rights reserved

OAuth and OpenID Connect for Microservices

Embed Size (px)

DESCRIPTION

Nordic APIs Platform Summit 2014. Presenter: Jacob Ideskog

Citation preview

Page 1: OAuth and OpenID Connect for Microservices

OAuth and OpenID Connect for Microservices A homogenous solution for a heterogeneous problem!Jacob Ideskog – Identity Specialist at Twobo Technologies!

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 2: OAuth and OpenID Connect for Microservices

Copyright © 2014 Twobo Technologies AB. All rights reserved

A Traditional Service

Page 3: OAuth and OpenID Connect for Microservices

Copyright © 2014 Twobo Technologies AB. All rights reserved

With Traditional Subsystems

Component C

Component D

Component A

Component B

Page 4: OAuth and OpenID Connect for Microservices

Copyright © 2014 Twobo Technologies AB. All rights reserved

… and traditional scalability

Page 5: OAuth and OpenID Connect for Microservices

But this is not always how we build systems

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 6: OAuth and OpenID Connect for Microservices

A microservice

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 7: OAuth and OpenID Connect for Microservices

Many microservices

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 8: OAuth and OpenID Connect for Microservices

Scaling microservices

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 9: OAuth and OpenID Connect for Microservices

So what’s the problem?

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 10: OAuth and OpenID Connect for Microservices

Securing a traditional service

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 11: OAuth and OpenID Connect for Microservices

Securing a traditional service

Copyright © 2014 Twobo Technologies AB. All rights reserved

User repository

Page 12: OAuth and OpenID Connect for Microservices

So for microservices that would mean

Copyright © 2014 Twobo Technologies AB. All rights reserved

User repository

Page 13: OAuth and OpenID Connect for Microservices

Not fantastic!

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 14: OAuth and OpenID Connect for Microservices

Lets talk about OAuth

Copyright © 2014 Twobo Technologies AB. All rights reserved

It’s not for Authentication …and not for Authorization

OAuth is a scalable delegation protocol

Page 15: OAuth and OpenID Connect for Microservices

OAuth has 4 actors

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO) Authorization Server (AS)

Resource Server (RS) Client

Page 16: OAuth and OpenID Connect for Microservices

The client requests access

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO) Authorization Server (AS)

Resource Server (RS) Client

Page 17: OAuth and OpenID Connect for Microservices

The AS requires the RO to authenticate

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO) Authorization Server (AS)

Resource Server (RS) Client

Page 18: OAuth and OpenID Connect for Microservices

The AS issues the tokens

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO) Authorization Server (AS)

Resource Server (RS) Client

Page 19: OAuth and OpenID Connect for Microservices

The Client presents the token to the RS

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO) Authorization Server (AS)

Resource Server (RS) Client

Page 20: OAuth and OpenID Connect for Microservices

The RS validates the Token

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO) Authorization Server (AS)

Resource Server (RS) Client

Page 21: OAuth and OpenID Connect for Microservices

Access!

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO) Authorization Server (AS)

Resource Server (RS) Client

Page 22: OAuth and OpenID Connect for Microservices

One very important thing��

- The Client knows nothing about the user

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 23: OAuth and OpenID Connect for Microservices

Open ID Connect�(Simplified)

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 24: OAuth and OpenID Connect for Microservices

Request Access

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO)

Authorization Server (AS)

Resource Server (RS) Client

Sessions

MyMail.com

Page 25: OAuth and OpenID Connect for Microservices

Get Redirected to AS

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO)

Authorization Server (AS)

Resource Server (RS) Client

Sessions

MyMail.com

Page 26: OAuth and OpenID Connect for Microservices

Challenged

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO)

Authorization Server (AS)

Resource Server (RS) Client

Sessions

MyMail.com

Page 27: OAuth and OpenID Connect for Microservices

Now – an ID Token ( ) is also given

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO)

Authorization Server (AS)

Resource Server (RS) Client

Sessions

MyMail.com

Page 28: OAuth and OpenID Connect for Microservices

Sessions can be created (SSO)

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO)

Authorization Server (AS)

Resource Server (RS) Client

Sessions

MyMail.com

Page 29: OAuth and OpenID Connect for Microservices

Tada!

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO)

Authorization Server (AS)

Resource Server (RS) Client

Sessions

MyMail.com

Page 30: OAuth and OpenID Connect for Microservices

What was interesting there?

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 31: OAuth and OpenID Connect for Microservices

TRUST

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 32: OAuth and OpenID Connect for Microservices

The ID Token is a JWT�(JSON Web Token)

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 33: OAuth and OpenID Connect for Microservices

A signed JSON document

Copyright © 2014 Twobo Technologies AB. All rights reserved

{          "sub":  "janedoe",          "name"  :  "Jane  Doe",          "email"  :  "[email protected]",          "phone_number"  "+46  (0)  12345678",          "aud":  "https://mymail.com",          "iss":  "https://fs.oidc.net",          "nbf":  1409213888783,          "jti":  "622a9973-­‐fc4d-­‐4797-­‐be31-­‐7c2116f549df",          "exp":  1409213890583,          "iat":  1409213888783    }  

{          "iss":  "https://fs.oidc.net",          "x5t":  "5F0A1359B4BB9FBB104155908DEC1FDCB5AC8865",          "typ":  "JWT",          "alg":  "RS256”  }  

Certificate orQOOKvXN3jbEpBSl0RHAyaQNxcx9DFgtMsJJgMxm9Az6QJMKKy6m0WvP1UzXZA_nsK16g9etg2yEW9IXbQU0RbSQktUtObRB9SxHtW_AcCk693XDAz15Y4aP9DeD62nROzd1MS4FZTmY3Cgzo1-3-sqW6_4Rgzs94aLO3aLP_zoVtJycCUKtJQhGhPTyjXXYWMsp0E4uTtL8Rif7cWu4olme_XNFlAs73pOrfzsQYc1GD2dB70l1M8SDaJZFURr9jAAaavX7Xqs_FPXY1PZLXLbc3ARXFmRf_-Z4B6uLCGI2shzl12ni54Yun6dflL9rQwaxXYuNZZodUWchID2cA

Signature

Page 34: OAuth and OpenID Connect for Microservices

OAuth Access Tokens can also be JWTs

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 35: OAuth and OpenID Connect for Microservices

2 types of tokens

Copyright © 2014 Twobo Technologies AB. All rights reserved

123XYZ

Jane Doe

By Value By Reference

Page 36: OAuth and OpenID Connect for Microservices

Contains NO information outside the network Copyright © 2014 Twobo Technologies AB. All rights reserved

123XYZ

Jane Doe

By Reference

Page 37: OAuth and OpenID Connect for Microservices

Contains ALL necessary information

Copyright © 2014 Twobo Technologies AB. All rights reserved

By Value

Page 38: OAuth and OpenID Connect for Microservices

External vs. Internal

Copyright © 2014 Twobo Technologies AB. All rights reserved

123XYZ

By Value By Reference

Outside the network Inside the network

API Firewall / Reverse Proxy API

Page 39: OAuth and OpenID Connect for Microservices

Token Translation

Copyright © 2014 Twobo Technologies AB. All rights reserved

123XYZ

By Value By Reference

Outside the network Inside the network

API Firewall / Reverse Proxy API

Page 40: OAuth and OpenID Connect for Microservices

Back to Microservices

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 41: OAuth and OpenID Connect for Microservices

2 Problems��

- Identifying the user�- Creating sessions�

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 42: OAuth and OpenID Connect for Microservices

Leave authentication to the OAuth/OIDC server

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO)

Authorization Server (AS)

Page 43: OAuth and OpenID Connect for Microservices

Let all Microservices accept JWTs

Copyright © 2014 Twobo Technologies AB. All rights reserved

Resource Owner (RO)

Page 44: OAuth and OpenID Connect for Microservices

BUT…��

Translate!

Copyright © 2014 Twobo Technologies AB. All rights reserved

Page 45: OAuth and OpenID Connect for Microservices

Copyright © 2014 Twobo Technologies AB. All rights reserved

Let all Microservices accept JWTs

Resource Owner (RO)

Reverse Proxy

123XYZ

Page 46: OAuth and OpenID Connect for Microservices

- everything is self contained�- standards based�

- non-reputable�- scalable

Copyright © 2014 Twobo Technologies AB. All rights reserved

Conclusion

Page 47: OAuth and OpenID Connect for Microservices

Copyright © 2014 Twobo Technologies AB. All rights reserved

Thank you!