oauth 2 presentation

19
OAuth 2 Mohamed Ahmed Abdullah

Upload: mohamed-ahmed-abdullah

Post on 22-Jan-2018

127 views

Category:

Software


0 download

TRANSCRIPT

Page 1: OAuth 2 Presentation

OAuth 2

Mohamed Ahmed Abdullah

Page 2: OAuth 2 Presentation

Google Calendar Dilemma

Mohamed

Secret 123

Page 3: OAuth 2 Presentation

Import Contact

ESPN

Facebook

Page 4: OAuth 2 Presentation

What is the Solution ?

X

Clients ScopesAuthorization Server

Page 5: OAuth 2 Presentation

In Reality (Mobile)

Page 6: OAuth 2 Presentation

In Reality (website)

Page 7: OAuth 2 Presentation

The Implicit Flow

Identity Server Resources Host Client (Desktop or Mobile)

Resource Owner

Pressing the Login Button

Client Id and Redirection URI

Client X want to access A,B and C (Scopes)

OK

Access Token

Get, Using Bearer Access Token

Is this Token Legitimate

Yes

Here are the Resources

Page 8: OAuth 2 Presentation

The Implicit Flow

https://identityserver.sudatel.sd/identityServer/identity/connect/consent?client_id=tripgalleryimplicit&redirect_uri=https%3A%2F%2Fidentityserver.sudatel.sd%2FIdentityServerClient%2Fcallback.html&response_type=token&scope=gallerymanagement

Login Redirection

Location:https://identityserver.sudatel.sd/IdentityServerClient/callback.html#access_token=eyJ0e…900 Char …….NGg&token_type=Bearer&expires_in=20&scope=gallerymanagement

When Finish From authorization the Identity Server Redirect to This Location

Page 9: OAuth 2 Presentation

Authorization Code

Page 10: OAuth 2 Presentation

Identity Server Resources HostClient

Resource OwnerServer Side Client Side (Browse)

Pressing the Login Button

Client Id and Redirection URI

Client X want to access A,B and C (Scopes)

OK

Authorization Code

Authorization Code + Client Secret

Authorization Token + Refresh Token

Authorization Token as cookie

Get, Using Bearer Access Token

Is this Token Legitimate

Yes

Here are the Resources

Page 11: OAuth 2 Presentation

The differences between Implicit Flow and Authorization Code

• Implicit for untrusted clients (Mobile, Desktop, Angular) Authorization Code For Servers (Web Sites, APIs) • Implicit access expire fast • In the implicit no use for the client secret • Implicit don’t have refresh token

Page 12: OAuth 2 Presentation

Resource Owner Password Flow

• The client is highly trusted• The App Remove the Password after getting the token

Page 13: OAuth 2 Presentation

Client Credential Flow

• The client want to access his data, not the User’s Data

• Should be used only if you have a server. you can’t do it from untrusted sources

Page 14: OAuth 2 Presentation

What is bad about OAuth

• Interoperability• You can’t write one peace of code that woks for all. Discover endpoints and log on to one of them

• In the Implicit flow, the redirect URI should be something odd to prevent the Browser from requesting it.

Page 15: OAuth 2 Presentation

When to Use OAuth

• Single Sign On • Scalable Solution (Many server) because it’s a stateless Authentication• Content Provider like (Facebook,…)• When you have 3 entities, your API, one of your users want to access other user’s data• Best Solution For Authorization

Page 16: OAuth 2 Presentation

Thanks To

Eran Hammer

Page 17: OAuth 2 Presentation

References and Resources

• https://github.com/IdentityServer/IdentityServer3

• Getting Started with OAuth 2.0• https://www.pluralsight.com/

Page 18: OAuth 2 Presentation

Any Question?

Page 19: OAuth 2 Presentation

How to setup OAuth

1. http://oauth.net/2/ .NET, JAVA, PHP, Python, NodeJS, Ruby, ….2. For .Net get it form https://github.com/IdentityServer/IdentityServer3

3. I Recommend to use real certificate for your development, it will speed up the process 4. Change the Constant Project URIs to Fit your URIs5. Build the Identity Server and the Resources Host6. Install Fiddler and Wireshark to help you debug your application7. At the development you can use in memory Users and Clients, but then you have to setup the Databases8. Then you can start With your developing APIs