SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Presenter: Jnana Ranjan Swain
Date: 27-6-2014
OAuth And REST Services
Presenter:Jnana Ranjan Swain, Mindfire Solutions
About Me
MCTS-70-515 - Microsoft .NET 4.0, Web App
Development
ASP.NET, WCF, SQLServer, Jquery,
jQueryUI, WindowsAzure,
EntityFramework, MVC
Facebook: http://www.facebook.com/jnanaswain
LinkedIn: http://www.linkedin.com/in/jnanaswain
Twitter: https://twitter.com/jnanaswain
Email: jnanas@mindfiresolutions.com
Skype: mfsi_jnanas
Skills
Connect Me
Contact Me
Certification
Agenda
Presenter:Jnana Ranjan Swain, Mindfire Solutions

Introduction To OAuth

OAuth Security Framework

OAuth .Net API

Building Rest Service using Asp.net WebAPI

Securing Rest API

Live Demo
OAuth
Presenter:Jnana Ranjan Swain, Mindfire Solutions
Introduction to OAuth
Presenter:Jnana Ranjan Swain, Mindfire Solutions

The OAuth protocol enables a third-party application to obtain
limited access to a HTTP services, on behalf of a resource
owner,without giving credentials.

OAuth 2.0 is the recent version,which is in development phase.

Facebook, Twitter, Google, Microsoft and many more companies are
using OAuth.
Presenter:Jnana Ranjan Swain, Mindfire Solutions
OAuth Framework
Presenter:Jnana Ranjan Swain, Mindfire Solutions

Resource Owner
- Granting access to a protected resource.

Resource Server
- The server hosting the protected resources, capable of accepting
and responding to protected resource requests using access tokens.

Client
- An application making protected resource requests on behalf of the
resource owner and with its authorization.

Authorization Server
- The server issuing access tokens to the client after successfully
authenticating the resource owner and obtaining authorization.
OAuth Roles
Presenter:Jnana Ranjan Swain, Mindfire Solutions
Access Token

Access tokens are credentials used to access protected
resources. An access token is a string representing an
authorization issued to the client

The resource server MUST validate the access token and
ensure that it has not expired and that its scope covers the
requested resource.

It can have different formats, structures, and methods of
utilization (e.g., cryptographic properties) based on the resource
server security requirements.
GET /plus/v1/people/me HTTP/1.1
Authorization: Bearer 1/fFBGRNJru1FQd44AzqT3Zg
Host: googleapis.com
Presenter:Jnana Ranjan Swain, Mindfire Solutions
Access Token Types

Bearer Token
A Bearer Token is set in the Authorization header of every inline
action HTTP Request.
Example :- Authorization:Bearer 4qF-UL0BGzu6n0YBJ

Mac Token
Message authentication code (MAC)
algorithm to provide cryptographic verification of portions of HTTP
requests
Presenter:Jnana Ranjan Swain, Mindfire Solutions
Refresh Token

Refresh tokens are credentials used to obtain access tokens.

Refresh tokens are issued to the client by the authorization server
and are used to obtain a new access token when the current access
token becomes invalid or expires,

If the authorization server issues a refresh token, it is included when
issuing an access token.
Example :{
"access_token":"1/fFAGRNJru1FTz70BzhT3Zg",
"expires_in":3920,
"token_type":"Bearer",
"refresh_token":"1/xEoDL4iW3cxlI7yDbSRFYNG01kVKM2C-
259HOF2aQbI"
}
Presenter:Jnana Ranjan Swain, Mindfire Solutions
Oauth .Net API
- Microsoft.Owin.Security
- API for creating Autherization server
new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/Token"),
Provider = new ApplicationOAuthProvider(PublicClientId,
UserManagerFactory),
AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
AllowInsecureHttp = true
};
Presenter:Jnana Ranjan Swain, Mindfire Solutions

It controls the lifecycle of Authorization Server

Used by Authorization Server to communicate with the web
application while processing requests.

It enables OAuth bearer token authentication middleware which will
receive and validate bearer token from authorization header in the
request.
•
OnValidateClientRedirectUri
•
OnValidateClientAuthentication
•
ValidateClientAuthentication
•
GrantResourceOwnerCredentials
•
OnGrantClientCredentials
OAuthAuthorizationServerProvider
Presenter:Jnana Ranjan Swain, Mindfire Solutions
Introduction to REST

Web services communicate via either SOAP or REST.

Representational state transfer is a way to create, read, update or delete
information on a server using simple HTTP calls. It is an alternative to
more complex mechanisms like SOAP.

Easily created using MVC 5 WebAPI and WCF
Presenter:Jnana Ranjan Swain, Mindfire Solutions
Building Rest Service using Asp.net WebAPI
Presenter:Jnana Ranjan Swain, Mindfire Solutions
Securing REST API

SSL

Cross-origin resource sharing (CORS)

OAUTH
Presenter:Jnana Ranjan Swain, Mindfire Solutions
Live Demo
Presenter:Jnana Ranjan Swain, Mindfire Solutions
References
http://oauth.net/
http://tools.ietf.org/
http://www.asp.net
https://developers.google.com
http://blog.rfaisal.com/
Presenter:Jnana Ranjan Swain, Mindfire Solutions
Question and Answer
Presenter:Jnana Ranjan Swain, Mindfire Solutions
Thank you
Presenter:Jnana Ranjan Swain, Mindfire Solutions
http://www.linkedin.com/company/mindfire-solutions
http://twitter.com/mindfires
Presenter: Jnana Ranjan Swain, Mindfire Solutions
http://www.mindfiresolutions.com
https://www.facebook.com/MindfireSolutions

Weitere ähnliche Inhalte

Andere mochten auch

Django mongodb -djangoday_
Django mongodb -djangoday_Django mongodb -djangoday_
Django mongodb -djangoday_
WEBdeBS
 
Django e il Rap Elia Contini
Django e il Rap Elia ContiniDjango e il Rap Elia Contini
Django e il Rap Elia Contini
WEBdeBS
 

Andere mochten auch (19)

EuroDjangoCon 2009 - Ein Rückblick
EuroDjangoCon 2009 - Ein RückblickEuroDjangoCon 2009 - Ein Rückblick
EuroDjangoCon 2009 - Ein Rückblick
 
Vim for Mere Mortals
Vim for Mere MortalsVim for Mere Mortals
Vim for Mere Mortals
 
NoSql Day - Apertura
NoSql Day - AperturaNoSql Day - Apertura
NoSql Day - Apertura
 
PyClab.__init__(self)
PyClab.__init__(self)PyClab.__init__(self)
PyClab.__init__(self)
 
NoSql Day - Chiusura
NoSql Day - ChiusuraNoSql Day - Chiusura
NoSql Day - Chiusura
 
Website optimization
Website optimizationWebsite optimization
Website optimization
 
2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to python2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to python
 
Load testing
Load testingLoad testing
Load testing
 
Django mongodb -djangoday_
Django mongodb -djangoday_Django mongodb -djangoday_
Django mongodb -djangoday_
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1
 
Rabbitmq & Postgresql
Rabbitmq & PostgresqlRabbitmq & Postgresql
Rabbitmq & Postgresql
 
Authentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVCAuthentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVC
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework  for perfectionists with deadlinesDjango - The Web framework  for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlines
 
Overview of Testing Talks at Pycon
Overview of Testing Talks at PyconOverview of Testing Talks at Pycon
Overview of Testing Talks at Pycon
 
Django e il Rap Elia Contini
Django e il Rap Elia ContiniDjango e il Rap Elia Contini
Django e il Rap Elia Contini
 
The Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contribThe Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contrib
 
User-centered open source
User-centered open sourceUser-centered open source
User-centered open source
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlinesDjango - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlines
 
PythonBrasil[8] closing
PythonBrasil[8] closingPythonBrasil[8] closing
PythonBrasil[8] closing
 

Mehr von Mindfire Solutions

Mehr von Mindfire Solutions (20)

Physician Search and Review
Physician Search and ReviewPhysician Search and Review
Physician Search and Review
 
diet management app
diet management appdiet management app
diet management app
 
Business Technology Solution
Business Technology SolutionBusiness Technology Solution
Business Technology Solution
 
Remote Health Monitoring
Remote Health MonitoringRemote Health Monitoring
Remote Health Monitoring
 
Influencer Marketing Solution
Influencer Marketing SolutionInfluencer Marketing Solution
Influencer Marketing Solution
 
ELMAH
ELMAHELMAH
ELMAH
 
High Availability of Azure Applications
High Availability of Azure ApplicationsHigh Availability of Azure Applications
High Availability of Azure Applications
 
IOT Hands On
IOT Hands OnIOT Hands On
IOT Hands On
 
Glimpse of Loops Vs Set
Glimpse of Loops Vs SetGlimpse of Loops Vs Set
Glimpse of Loops Vs Set
 
Oracle Sql Developer-Getting Started
Oracle Sql Developer-Getting StartedOracle Sql Developer-Getting Started
Oracle Sql Developer-Getting Started
 
Adaptive Layout In iOS 8
Adaptive Layout In iOS 8Adaptive Layout In iOS 8
Adaptive Layout In iOS 8
 
Introduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/MacIntroduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/Mac
 
LINQPad - utility Tool
LINQPad - utility ToolLINQPad - utility Tool
LINQPad - utility Tool
 
Get started with watch kit development
Get started with watch kit developmentGet started with watch kit development
Get started with watch kit development
 
Swift vs Objective-C
Swift vs Objective-CSwift vs Objective-C
Swift vs Objective-C
 
Material Design in Android
Material Design in AndroidMaterial Design in Android
Material Design in Android
 
Introduction to OData
Introduction to ODataIntroduction to OData
Introduction to OData
 
Ext js Part 2- MVC
Ext js Part 2- MVCExt js Part 2- MVC
Ext js Part 2- MVC
 
ExtJs Basic Part-1
ExtJs Basic Part-1ExtJs Basic Part-1
ExtJs Basic Part-1
 
Spring Security Introduction
Spring Security IntroductionSpring Security Introduction
Spring Security Introduction
 

Kürzlich hochgeladen

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Kürzlich hochgeladen (20)

How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 

OAuth and Rest

  • 1. Presenter: Jnana Ranjan Swain Date: 27-6-2014 OAuth And REST Services
  • 2. Presenter:Jnana Ranjan Swain, Mindfire Solutions About Me MCTS-70-515 - Microsoft .NET 4.0, Web App Development ASP.NET, WCF, SQLServer, Jquery, jQueryUI, WindowsAzure, EntityFramework, MVC Facebook: http://www.facebook.com/jnanaswain LinkedIn: http://www.linkedin.com/in/jnanaswain Twitter: https://twitter.com/jnanaswain Email: jnanas@mindfiresolutions.com Skype: mfsi_jnanas Skills Connect Me Contact Me Certification
  • 3. Agenda Presenter:Jnana Ranjan Swain, Mindfire Solutions  Introduction To OAuth  OAuth Security Framework  OAuth .Net API  Building Rest Service using Asp.net WebAPI  Securing Rest API  Live Demo
  • 5. Introduction to OAuth Presenter:Jnana Ranjan Swain, Mindfire Solutions  The OAuth protocol enables a third-party application to obtain limited access to a HTTP services, on behalf of a resource owner,without giving credentials.  OAuth 2.0 is the recent version,which is in development phase.  Facebook, Twitter, Google, Microsoft and many more companies are using OAuth.
  • 6. Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 7. OAuth Framework Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 8.  Resource Owner - Granting access to a protected resource.  Resource Server - The server hosting the protected resources, capable of accepting and responding to protected resource requests using access tokens.  Client - An application making protected resource requests on behalf of the resource owner and with its authorization.  Authorization Server - The server issuing access tokens to the client after successfully authenticating the resource owner and obtaining authorization. OAuth Roles Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 9. Access Token  Access tokens are credentials used to access protected resources. An access token is a string representing an authorization issued to the client  The resource server MUST validate the access token and ensure that it has not expired and that its scope covers the requested resource.  It can have different formats, structures, and methods of utilization (e.g., cryptographic properties) based on the resource server security requirements. GET /plus/v1/people/me HTTP/1.1 Authorization: Bearer 1/fFBGRNJru1FQd44AzqT3Zg Host: googleapis.com Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 10. Access Token Types  Bearer Token A Bearer Token is set in the Authorization header of every inline action HTTP Request. Example :- Authorization:Bearer 4qF-UL0BGzu6n0YBJ  Mac Token Message authentication code (MAC) algorithm to provide cryptographic verification of portions of HTTP requests Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 11. Refresh Token  Refresh tokens are credentials used to obtain access tokens.  Refresh tokens are issued to the client by the authorization server and are used to obtain a new access token when the current access token becomes invalid or expires,  If the authorization server issues a refresh token, it is included when issuing an access token. Example :{ "access_token":"1/fFAGRNJru1FTz70BzhT3Zg", "expires_in":3920, "token_type":"Bearer", "refresh_token":"1/xEoDL4iW3cxlI7yDbSRFYNG01kVKM2C- 259HOF2aQbI" } Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 12. Oauth .Net API - Microsoft.Owin.Security - API for creating Autherization server new OAuthAuthorizationServerOptions { TokenEndpointPath = new PathString("/Token"), Provider = new ApplicationOAuthProvider(PublicClientId, UserManagerFactory), AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"), AccessTokenExpireTimeSpan = TimeSpan.FromDays(14), AllowInsecureHttp = true }; Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 13.  It controls the lifecycle of Authorization Server  Used by Authorization Server to communicate with the web application while processing requests.  It enables OAuth bearer token authentication middleware which will receive and validate bearer token from authorization header in the request. • OnValidateClientRedirectUri • OnValidateClientAuthentication • ValidateClientAuthentication • GrantResourceOwnerCredentials • OnGrantClientCredentials OAuthAuthorizationServerProvider Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 14. Introduction to REST  Web services communicate via either SOAP or REST.  Representational state transfer is a way to create, read, update or delete information on a server using simple HTTP calls. It is an alternative to more complex mechanisms like SOAP.  Easily created using MVC 5 WebAPI and WCF Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 15. Building Rest Service using Asp.net WebAPI Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 16. Securing REST API  SSL  Cross-origin resource sharing (CORS)  OAUTH Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 17. Live Demo Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 19. Question and Answer Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 20. Thank you Presenter:Jnana Ranjan Swain, Mindfire Solutions
  • 21. http://www.linkedin.com/company/mindfire-solutions http://twitter.com/mindfires Presenter: Jnana Ranjan Swain, Mindfire Solutions http://www.mindfiresolutions.com https://www.facebook.com/MindfireSolutions