SlideShare a Scribd company logo
By Anirban Sen Chowdhary
We often required to secure our web services specially those are accessed by the
external world.
What about securing a RESTful web services ???
Rest security with oauth 2.0
Yes .. We can .. I will show you this trick .. How ??
We can easily secure our REST service using OAUTH 2.0
For implementing OAUTH 2.0 in our REST web service we require 3
steps :-
• Authorisation to obtain a secret code
• Use that secret code to obtain an access_token
• Use the access_token to validate and access the web service
Let us we have following Mule flow:-
Here is our web service which will be secured by using OAUTH 2.0 security. You can
see the OAUTH 2.0 component is placed between HTTP and CXF component which
will validate the access_token and will permit to accesses the web service
The corresponding Mule flow will be as follows:-
Here is you can see OAUTH 2.0 is validating the access_token coming from HTTP
Here you can see we have configured the Spring security with username and
password to obtain a secret code. Also in oauth2 provider config we configured
client id and client secret
Authorization to obtain a secret code
Now we will go with first step :
Step 1 :- Authorisation to obtain a secret code
We will put the following url in browser :-
http://localhost:8084/tweetbook/api/authorize?response_type=code&client_id=e7aaf348-f08a-11e1-
9237-96c6dd6a022f&scope=READ_BOOKSHELF&redirect_uri=http://localhost:8082/getData/insert
You can see we are passing client id and client code in our url and we will
get the above page for login
We will be providing the username and password configure in our Spring security
in Mule Config:-
username john and password is doe in our case, and we will hit login
and Authorize button
We will get a secrete code in browser url as following :-
We will use that secret code to obtain an access_token
Use that secret code to obtain an access_token
Now we will go with second step :
Step 2 :- Use that secret code to obtain an access_token
We need to include the secret code in our url as follows :-
http://localhost:8084/tweetbook/api/token?grant_type=AUTHORIZATION_CODE&client_id=e7aaf348-f08a-11e1-
9237-96c6dd6a022f&client_secret=ee9acaa2-f08a-11e1-bc20-
96c6dd6a022f&code=lkE9VJmNmTBbzVl1plkMffuj3jlIOavtWeaWsxk3gVMglbfo_dvGnX9HJoXMSOGPw29E2H00kwX8
5YOxNlLFTg&redirect_uri=http://localhost:8082/getData/insert
We will use that secret code to obtain an access_token.
And now you can see we got the access_token in the browser.
And this access_token will be using to access our web service
Use the access_token to validate and access the web service
Now we will go with third step :
Step 3 :- Use the access_token to validate and access the web service
We need the access_token to be pass as a header when accessing web service as
follows
You can see we are using REST Client for testing our web service and
passing the access_token in the header
Now, you can see that if we hit the web service in the REST Client with the an
access_token in the header, the secured service is providing the response
In my next slide I will bring some other techniques in Mule
implementation .
Hope you have enjoyed this simpler version.
Keep sharing your knowledge and let our Mule community grow 
Rest security with oauth 2.0

More Related Content

PPTX
Rest security in mule
PPTX
Demo on Mule ESB Facebook Connector
PPTX
Https service mule
PPTX
Mule ESB integration with Stripe
PPTX
Salesforce Integration using Mule ESB
PPTX
Integrate facebook using mule esb
PPTX
Mule with facebook
PPTX
Mule esb - How to connect to a MySql Database in 5 minutes
Rest security in mule
Demo on Mule ESB Facebook Connector
Https service mule
Mule ESB integration with Stripe
Salesforce Integration using Mule ESB
Integrate facebook using mule esb
Mule with facebook
Mule esb - How to connect to a MySql Database in 5 minutes

What's hot (18)

PPTX
Deploy with maven
PPTX
Mule velocity
PPTX
Integrate with facebook connector
PPTX
Integration with dropbox
PPTX
Integrate to retrieve data microsoft azure
PPTX
Deploying and Running in Mule
PPTX
Expose web service
PPTX
Manage and consume the api
PPTX
Mule Salesforce Connector
PPTX
Mule organization
PPTX
Mule management console installation
PPTX
Mule esb stripe
PPT
Installing mule
PPTX
Mule Integration with Dropbox
PPTX
Integration with CMIS using Mule ESB
PPTX
Integration with sales force
PPTX
Popular Wordpress Plug-ins of May 2013
PPTX
Integration with Microsoft SharePoint using Mule ESB
Deploy with maven
Mule velocity
Integrate with facebook connector
Integration with dropbox
Integrate to retrieve data microsoft azure
Deploying and Running in Mule
Expose web service
Manage and consume the api
Mule Salesforce Connector
Mule organization
Mule management console installation
Mule esb stripe
Installing mule
Mule Integration with Dropbox
Integration with CMIS using Mule ESB
Integration with sales force
Popular Wordpress Plug-ins of May 2013
Integration with Microsoft SharePoint using Mule ESB
Ad

Viewers also liked (20)

PPTX
Deploy apps in standalone with maven
PDF
Detection of REST Patterns and Antipatterns: A Heuristics-based Approach
PDF
Stateful Web Services - Short Report
PPT
Stateful Web Services - Presentation
PDF
REST API Doc Best Practices
PPT
Web Services Security - Presentation
PPTX
PDF
Spring camp 발표자료
PPTX
Declarative authorization in REST services in SharePoint with F# and ServiceS...
PDF
REST API Best (Recommended) Practices
PDF
A microservice architecture based on golang
PDF
Some REST Design Patterns (and Anti-Patterns) - SOA Symposium 2009
PDF
OAuth2 and Spring Security
PDF
Modern Security with OAuth 2.0 and JWT and Spring by Dmitry Buzdin
PPTX
An Introduction to OAuth 2
PPTX
Spring Security
PDF
Microservices in Golang
PPTX
Best Practices for API Security
PDF
Microservice With Spring Boot and Spring Cloud
PPTX
REST API Security: OAuth 2.0, JWTs, and More!
Deploy apps in standalone with maven
Detection of REST Patterns and Antipatterns: A Heuristics-based Approach
Stateful Web Services - Short Report
Stateful Web Services - Presentation
REST API Doc Best Practices
Web Services Security - Presentation
Spring camp 발표자료
Declarative authorization in REST services in SharePoint with F# and ServiceS...
REST API Best (Recommended) Practices
A microservice architecture based on golang
Some REST Design Patterns (and Anti-Patterns) - SOA Symposium 2009
OAuth2 and Spring Security
Modern Security with OAuth 2.0 and JWT and Spring by Dmitry Buzdin
An Introduction to OAuth 2
Spring Security
Microservices in Golang
Best Practices for API Security
Microservice With Spring Boot and Spring Cloud
REST API Security: OAuth 2.0, JWTs, and More!
Ad

Similar to Rest security with oauth 2.0 (20)

PPTX
Securing api with_o_auth2
PDF
Building an API Security Ecosystem
PDF
Best Practices in Building an API Security Ecosystem
PPTX
Rest API Security
PDF
Webapp security (with notes)
PPTX
API Security : Patterns and Practices
PPTX
Oauth 2.0 Introduction and Flows with MuleSoft
PPTX
Mule soft Meetup #3
PPTX
How to Secure Mule API's With a Demo
PPTX
Api security-eic-prabath
ODP
Mule security
PDF
Secured REST Microservices with Spring Cloud
PDF
WSO2Con USA 2015: Securing your APIs: Patterns and More
ODP
Security components in mule esb
PDF
Full stack security
PDF
Web App Security for Java Developers - PWX 2021
PDF
Web App Security for Java Developers - UberConf 2021
PPTX
Securing ap is oauth and fine grained access control
PPTX
HTTP Services & REST API Security
Securing api with_o_auth2
Building an API Security Ecosystem
Best Practices in Building an API Security Ecosystem
Rest API Security
Webapp security (with notes)
API Security : Patterns and Practices
Oauth 2.0 Introduction and Flows with MuleSoft
Mule soft Meetup #3
How to Secure Mule API's With a Demo
Api security-eic-prabath
Mule security
Secured REST Microservices with Spring Cloud
WSO2Con USA 2015: Securing your APIs: Patterns and More
Security components in mule esb
Full stack security
Web App Security for Java Developers - PWX 2021
Web App Security for Java Developers - UberConf 2021
Securing ap is oauth and fine grained access control
HTTP Services & REST API Security

More from Anirban Sen Chowdhary (20)

PPTX
Change the game with Game changer
PPTX
Ring central desktop app overview
PPTX
Overview in ringcentral digital line
PPTX
Some basics with ring central
PPTX
Ring central and python
PPTX
RingCentral application development overview
PPTX
Cloze connect ringcentral
PPTX
Overview on ring central errors part 4
PPTX
Setting up your ring central sandbox in steps
PPTX
Overview on ring central errors: part 2
PPTX
Overview on ring central errors
PPTX
Call recording overview ring central
PPTX
Ring central engaging with amazon alexa
PPTX
How ring central sdk changing the game
PPTX
When ring central connect salesforce
PPTX
Mule 4 connecting ring central
PPTX
Ring central sdk
PPTX
Ring central with okta
PPTX
Ring central connecting salesforce overview
PPTX
Ring central call logs overview (part 2)
Change the game with Game changer
Ring central desktop app overview
Overview in ringcentral digital line
Some basics with ring central
Ring central and python
RingCentral application development overview
Cloze connect ringcentral
Overview on ring central errors part 4
Setting up your ring central sandbox in steps
Overview on ring central errors: part 2
Overview on ring central errors
Call recording overview ring central
Ring central engaging with amazon alexa
How ring central sdk changing the game
When ring central connect salesforce
Mule 4 connecting ring central
Ring central sdk
Ring central with okta
Ring central connecting salesforce overview
Ring central call logs overview (part 2)

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
KodekX | Application Modernization Development
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Empathic Computing: Creating Shared Understanding
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation theory and applications.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Chapter 3 Spatial Domain Image Processing.pdf
KodekX | Application Modernization Development
Diabetes mellitus diagnosis method based random forest with bat algorithm
MYSQL Presentation for SQL database connectivity
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Empathic Computing: Creating Shared Understanding
Reach Out and Touch Someone: Haptics and Empathic Computing
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Review of recent advances in non-invasive hemoglobin estimation
NewMind AI Weekly Chronicles - August'25 Week I
Programs and apps: productivity, graphics, security and other tools
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation theory and applications.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Unlocking AI with Model Context Protocol (MCP)
The Rise and Fall of 3GPP – Time for a Sabbatical?

Rest security with oauth 2.0

  • 1. By Anirban Sen Chowdhary
  • 2. We often required to secure our web services specially those are accessed by the external world. What about securing a RESTful web services ???
  • 4. Yes .. We can .. I will show you this trick .. How ??
  • 5. We can easily secure our REST service using OAUTH 2.0
  • 6. For implementing OAUTH 2.0 in our REST web service we require 3 steps :- • Authorisation to obtain a secret code • Use that secret code to obtain an access_token • Use the access_token to validate and access the web service
  • 7. Let us we have following Mule flow:- Here is our web service which will be secured by using OAUTH 2.0 security. You can see the OAUTH 2.0 component is placed between HTTP and CXF component which will validate the access_token and will permit to accesses the web service
  • 8. The corresponding Mule flow will be as follows:- Here is you can see OAUTH 2.0 is validating the access_token coming from HTTP
  • 9. Here you can see we have configured the Spring security with username and password to obtain a secret code. Also in oauth2 provider config we configured client id and client secret
  • 10. Authorization to obtain a secret code
  • 11. Now we will go with first step : Step 1 :- Authorisation to obtain a secret code We will put the following url in browser :- http://localhost:8084/tweetbook/api/authorize?response_type=code&client_id=e7aaf348-f08a-11e1- 9237-96c6dd6a022f&scope=READ_BOOKSHELF&redirect_uri=http://localhost:8082/getData/insert You can see we are passing client id and client code in our url and we will get the above page for login
  • 12. We will be providing the username and password configure in our Spring security in Mule Config:- username john and password is doe in our case, and we will hit login and Authorize button
  • 13. We will get a secrete code in browser url as following :- We will use that secret code to obtain an access_token
  • 14. Use that secret code to obtain an access_token
  • 15. Now we will go with second step : Step 2 :- Use that secret code to obtain an access_token We need to include the secret code in our url as follows :- http://localhost:8084/tweetbook/api/token?grant_type=AUTHORIZATION_CODE&client_id=e7aaf348-f08a-11e1- 9237-96c6dd6a022f&client_secret=ee9acaa2-f08a-11e1-bc20- 96c6dd6a022f&code=lkE9VJmNmTBbzVl1plkMffuj3jlIOavtWeaWsxk3gVMglbfo_dvGnX9HJoXMSOGPw29E2H00kwX8 5YOxNlLFTg&redirect_uri=http://localhost:8082/getData/insert We will use that secret code to obtain an access_token. And now you can see we got the access_token in the browser. And this access_token will be using to access our web service
  • 16. Use the access_token to validate and access the web service
  • 17. Now we will go with third step : Step 3 :- Use the access_token to validate and access the web service We need the access_token to be pass as a header when accessing web service as follows You can see we are using REST Client for testing our web service and passing the access_token in the header
  • 18. Now, you can see that if we hit the web service in the REST Client with the an access_token in the header, the secured service is providing the response
  • 19. In my next slide I will bring some other techniques in Mule implementation . Hope you have enjoyed this simpler version. Keep sharing your knowledge and let our Mule community grow 