SlideShare uma empresa Scribd logo
1 de 35
OAuth with Salesforce -
Demystified
calvin.noronha@bluewolf.com, @calvin_nr
Calvin Noronha, Technical Architect at Bluewolf, an IBM company
Agenda
Introduction
Authentication v/s Authorization
Authorization - OAuth 2.0
Connected Apps
Tokens, Client ID and Client secret
OAuth scopes
OAuth flows
Demo – 1
Authentication - OpenID Connect
OpenID providers
OpenID Protocol
OpenID response with ID token
Demo – 2
Identity and Access Management Designer Certification
Q&A
Introduction
Authentication v/s Authorization
Pic1: https://i.imgur.com/y6dBO1Y.png
Pic2:https://media.licdn.com/mpr/mpr/AAEAAQAAAAAAAAnMAAAAJDgxMTA4ODRkLWRiYzItNDZkYS05ZDI2LTY3MDFkNmM1NWNhMA.jpg
Authentication Authorization
Who you are?
Example: Checking into a hotel
at the front desk
What you can do?
Example: Hotel key card gives
access to room, gym and pool
Authentication
 Authentication is a process of identifying a user based on a set of verifiable credentials such as
a username and password.
 In a client-server paradigm, a server validates the identity of a client either by itself or by
forwarding the request to a trusted 3rd party provider.
 Authentication determines if you are really who you say you are.
 Identity Management
Authorization
 Authorization determines if a user has permission to access resources on the server post
authentication.
 During Authorization, the system verifies the access of an authenticated user and can:
Grant access to protected resources
Deny access
 Authorization cannot occur without Authentication
 Access Management
Authorization
What is OAuth?
You may have seen options to login to websites using your Salesforce or social media
credentials.
An open protocol to allow secure authorization in a simple and standard method from web,
mobile and desktop applications.
• (Official definition from OAuth.net)
What does this mean?
• Basically allows a user’s information to be used by a 3rd party service without exposing the user’s
password.
OAuth 2.0
Why OAuth 2.0?
 Security – Can you trust a 3rd party application with your password?
 End users can authorize 3rd party applications with a click of a button.
 OAuth can work securely with SSL so data transfer is protected.
 Access to the resource server can be revoked easily.
 As a developer, you no longer stored passwords inside source code!
Roles in an OAuth flow
Enter Tokens
 “Tokens” do the actual heavy lifting in OAuth 2.0
 Used instead of usernames and passwords to grant access to specified resources for a
specified duration.
 Three types:
• Access – Short lived token which allows the application to access user data. In Salesforce, this is your session ID.
• Refresh – Long lived token which can be used to acquire a new access token. Can be revoked.
• ID token – This is related to OpenID Connect which we will review a bit later.
Salesforce and OAuth 2.0
 Salesforce provides extensive support for OAuth 2.0
 Support began since Winter’11!
 Around eight types of OAuth “flows” are supported by Salesforce as of Nov 2017.
 You can easily access Salesforce API’s such as the REST API or Chatter API’s using OAuth.
Connected App
 This is a special kind of Salesforce App that allows us to access Salesforce API’s using OAuth
2.0.
 Connected Apps do the following:
• Authenticate
• Provide Single Sign On
• Acquire access tokens
 You can provide the following information:
• Redirect URL, Scope etc.
 After configuring the Connected App, you will receive the Client Id and Client secret.
 Control user access with Profiles and Permission sets.
Connected App
Client ID and Client secret
 Any application that works with OAuth generally needs 2 pieces of information.
 Client ID – This is a public identifier for your application.
• Should be unique across all clients.
• Best to be non-guessable.
• Example: Salesforce -
3MVG9d8..z.hDcPK2PZTmDxggApSo.Cdd2H7ME9w6Yp6AUgEJeeCdkvXVLfpnFialOG.JQLmPFWxhSwcxV_A7
 Client Secret – This is a secret value known only to the application and authorization server.
• Should be used only in the web-server flow.
• Never include this in a mobile or browser based app as it cannot be protected.
OAuth Scopes
 Scopes provide selective enabling of
access to a user’s account based on
required functionality.
 In Salesforce, scopes control the types
of resources available to an application.
Some of the scopes are:
api
chatter_api
full
id
refresh_token
web
OAuth access token request
Parameters:
 Code
 Grant_type
 Client_id
 Client_secret
 Redirect_url
OAuth response payload
OAuth Flows in Salesforce
 Web-Server flow
 User-Agent flow
 Username-Password flow
 SAML Bearer Assertion flow
 JWT Bearer Token flow
Web-Server Flow
 Used by web server applications which need to interact with Force.com API’s on behalf of a
user.
 These web apps run on a server where the code is not available publicly.
 Higher degree of security because the client secret is protected.
 Use when: You have a web application running on a server that can securely store the
consumer secret.
Web Server Flow
Diagram taken from: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_web_server_oauth_flow.htm
Other OAuth flows
OAuth Flow Use Case
User-Agent flow You have a client side mobile/browser application which cannot secure
the client secret.
Username-Password flow Used by applications that work without requiring user interaction to
actively give authorization.
SAML Bearer Assertion Flow A signed SAML 2.0 Assertion along with a digital signature can be used to
obtain an OAuth access token.
JWT Bearer Token Flow Server-to-server API integration uses JSON Web Token (JWT) to obtain
an OAuth access token.
Demo - 1
 Use the Web Server OAuth flow to integrate an external website on Heroku with Salesforce.
 Fetch and display recently modified Account records.
 The demo will comprise of:
 Quick walkthrough of the working solution
 Step by step explanation of the OAuth flow
 Understanding implications of OAuth scopes.
 Explanation of the how the solution was built along with config and code walkthrough.
 Built using:
 Heroku
 ForceTK library
 HTML, CSS, Bootstrap
Authentication
OpenID Connect
 OAuth 2.0 is great at providing Authorization. SAML is generally used for Single Sign On
authentication.
 OpenID Connect is a identity layer built on top of the OAuth 2.0 protocol.
 It allows the verification of an end user using authentication performed by the Authorization server.
 This is Authentication which is deeply integrated with Authorization.
 Salesforce uses it to authenticate users across orgs and providers.
OpenID Providers
Why not use OAuth 2.0 for Authentication?
 OAuth 2.0 was designed for Authorization and identity is out of its scope.
 Access token does not represent a user’s identity.
 OpenID helps to implement single sign on.
 OpenID Connect is OAuth Authorization + Authentication.
OpenID Connect Protocol
Diagram taken from: https://developer.salesforce.com/page/Inside_OpenID_Connect_on_Force.com
OpenID Connect response
Diagram taken from: https://developer.salesforce.com/page/Inside_OpenID_Connect_on_Force.com
Demo - 2
 Social Sign On into a Salesforce org using Google credentials with Google as the OpenID
identity provider.
 The demo will comprise of:
• Quick walkthrough of the working solution
• Understand how to easily set up an OpenID login to Salesforce.
• Understanding the role of the Authentication Provider.
• Explanation of the how the solution was built along with config and code walkthrough.
 Part of the Architect
designer certifications and
is required to complete the
“System Architect”
Certification, a prerequisite
for the Salesforce Certified
Technical Architect (CTA).
 Part of the
#JourneyToCTA
Identity and Access Management Designer Certification
 Authentication and Authorization related concepts with
Salesforce w.r.t to Single Sign On (SSO)
 Understanding of the various Salesforce Identity features.
 Knowledge of the different OAuth 2.0 flows.
 Covers related security features such as 2FA and high
assurance sessions.
 http://bit.ly/2gqrama
Further Reading
URL Description
http://sforce.co/2zypdaQ Learn more about Salesforce OAuth flows
https://oauth.net/ Official OAuth website.
http://sforce.co/2yKcNiB Certified Identity and Access Management Designer Certification.
http://www.decodingthecloud.com My blog.
http://bit.ly/2h4BSMf Access Salesforce API’s using JSForce.
http://bit.ly/2ivxRUC Access Google API’s using OAuth 2.0
http://bit.ly/2xispH1 A tutorial about integrating Salesforce and LinkedIn using OAuth
2.0
http://bit.ly/2y2j8r6 Access the Fitbit API using OAuth 2.0
http://bit.ly/2ivNxHe The actual OAuth 2.0 protocol.
http://sforce.co/2zypdaQ Best Salesforce article about OAuth 2.0
http://sforce.co/2iufb7s Identity and Access Management Trailhead trail.
Questions?
@calvin_n
r
http://bit.ly/2yv55ul

Mais conteúdo relacionado

Mais procurados

Salesforce Security Model (Dmitry Goshko, Igor Haritonovich)
Salesforce Security Model (Dmitry Goshko, Igor Haritonovich)Salesforce Security Model (Dmitry Goshko, Igor Haritonovich)
Salesforce Security Model (Dmitry Goshko, Igor Haritonovich)
Yury Bondarau
 

Mais procurados (20)

Salesforce integration best practices columbus meetup
Salesforce integration best practices   columbus meetupSalesforce integration best practices   columbus meetup
Salesforce integration best practices columbus meetup
 
Flow in Salesforce
Flow in SalesforceFlow in Salesforce
Flow in Salesforce
 
Salesforce Integration
Salesforce IntegrationSalesforce Integration
Salesforce Integration
 
Lightning Web Components- Ep 1 - Decorators, Life Cycle Hooks and Compositions
Lightning Web Components- Ep 1 - Decorators, Life Cycle Hooks and CompositionsLightning Web Components- Ep 1 - Decorators, Life Cycle Hooks and Compositions
Lightning Web Components- Ep 1 - Decorators, Life Cycle Hooks and Compositions
 
Salesforce Security Best Practices for Every Admin
Salesforce Security Best Practices for Every AdminSalesforce Security Best Practices for Every Admin
Salesforce Security Best Practices for Every Admin
 
Exploring the Salesforce REST API
Exploring the Salesforce REST APIExploring the Salesforce REST API
Exploring the Salesforce REST API
 
Salesforce Security Model (Dmitry Goshko, Igor Haritonovich)
Salesforce Security Model (Dmitry Goshko, Igor Haritonovich)Salesforce Security Model (Dmitry Goshko, Igor Haritonovich)
Salesforce Security Model (Dmitry Goshko, Igor Haritonovich)
 
REST API in Salesforce
REST API in SalesforceREST API in Salesforce
REST API in Salesforce
 
Governor limits
Governor limitsGovernor limits
Governor limits
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura Interoperability
 
Introducing the Salesforce platform
Introducing the Salesforce platformIntroducing the Salesforce platform
Introducing the Salesforce platform
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An Introduction
 
Episode 20 - Trigger Frameworks in Salesforce
Episode 20 - Trigger Frameworks in SalesforceEpisode 20 - Trigger Frameworks in Salesforce
Episode 20 - Trigger Frameworks in Salesforce
 
Automate All The Things with Flow
Automate All The Things with FlowAutomate All The Things with Flow
Automate All The Things with Flow
 
Getting started with Salesforce security
Getting started with Salesforce securityGetting started with Salesforce security
Getting started with Salesforce security
 
Salesforce complete overview
Salesforce complete overviewSalesforce complete overview
Salesforce complete overview
 
Live coding with LWC
Live coding with LWCLive coding with LWC
Live coding with LWC
 
Introduction to Apex Triggers
Introduction to Apex TriggersIntroduction to Apex Triggers
Introduction to Apex Triggers
 
Integrating with salesforce
Integrating with salesforceIntegrating with salesforce
Integrating with salesforce
 
Best Practices with Apex in 2022.pdf
Best Practices with Apex in 2022.pdfBest Practices with Apex in 2022.pdf
Best Practices with Apex in 2022.pdf
 

Semelhante a OAuth with Salesforce - Demystified

Oauth2 and OWSM OAuth2 support
Oauth2 and OWSM OAuth2 supportOauth2 and OWSM OAuth2 support
Oauth2 and OWSM OAuth2 support
Gaurav Sharma
 
Authentication with OAuth and Connected Apps
Authentication with OAuth and Connected AppsAuthentication with OAuth and Connected Apps
Authentication with OAuth and Connected Apps
Salesforce Developers
 

Semelhante a OAuth with Salesforce - Demystified (20)

Microsoft Graph API Webinar Application Permissions
Microsoft Graph API Webinar Application PermissionsMicrosoft Graph API Webinar Application Permissions
Microsoft Graph API Webinar Application Permissions
 
Ladies Be Architects - Study Group III: OAuth 2.0 (Ep 1)
Ladies Be Architects - Study Group III: OAuth 2.0 (Ep 1)Ladies Be Architects - Study Group III: OAuth 2.0 (Ep 1)
Ladies Be Architects - Study Group III: OAuth 2.0 (Ep 1)
 
O auth2 with angular js
O auth2 with angular jsO auth2 with angular js
O auth2 with angular js
 
OAuth 2.0 - The fundamentals, the good , the bad, technical primer and commo...
OAuth 2.0  - The fundamentals, the good , the bad, technical primer and commo...OAuth 2.0  - The fundamentals, the good , the bad, technical primer and commo...
OAuth 2.0 - The fundamentals, the good , the bad, technical primer and commo...
 
Oauth2 and OWSM OAuth2 support
Oauth2 and OWSM OAuth2 supportOauth2 and OWSM OAuth2 support
Oauth2 and OWSM OAuth2 support
 
GHC18 Abstract - API Security, a Grail Quest
GHC18 Abstract - API Security, a Grail QuestGHC18 Abstract - API Security, a Grail Quest
GHC18 Abstract - API Security, a Grail Quest
 
Stateless Auth using OAuth2 & JWT
Stateless Auth using OAuth2 & JWTStateless Auth using OAuth2 & JWT
Stateless Auth using OAuth2 & JWT
 
Deep dive into Salesforce Connected App
Deep dive into Salesforce Connected AppDeep dive into Salesforce Connected App
Deep dive into Salesforce Connected App
 
Stateless Auth using OAUTH2 & JWT
Stateless Auth using OAUTH2 & JWTStateless Auth using OAUTH2 & JWT
Stateless Auth using OAUTH2 & JWT
 
Implementing Microservices Security Patterns & Protocols with Spring
Implementing Microservices Security Patterns & Protocols with SpringImplementing Microservices Security Patterns & Protocols with Spring
Implementing Microservices Security Patterns & Protocols with Spring
 
Authentication with OAuth and Connected Apps
Authentication with OAuth and Connected AppsAuthentication with OAuth and Connected Apps
Authentication with OAuth and Connected Apps
 
Azure AD B2C An Introduction - DogFoodCon 2018
Azure AD B2C An Introduction - DogFoodCon 2018Azure AD B2C An Introduction - DogFoodCon 2018
Azure AD B2C An Introduction - DogFoodCon 2018
 
OAuth2 Introduction
OAuth2 IntroductionOAuth2 Introduction
OAuth2 Introduction
 
EduID Mobile App - Use-Cases, Concepts and Implementation
EduID Mobile App - Use-Cases, Concepts and ImplementationEduID Mobile App - Use-Cases, Concepts and Implementation
EduID Mobile App - Use-Cases, Concepts and Implementation
 
API Security with OAuth2.0.
API Security with OAuth2.0.API Security with OAuth2.0.
API Security with OAuth2.0.
 
REST API Authentication Methods.pdf
REST API Authentication Methods.pdfREST API Authentication Methods.pdf
REST API Authentication Methods.pdf
 
Microsoft Graph API Delegated Permissions
Microsoft Graph API Delegated PermissionsMicrosoft Graph API Delegated Permissions
Microsoft Graph API Delegated Permissions
 
Securing RESTful API
Securing RESTful APISecuring RESTful API
Securing RESTful API
 
OAuth 2.0 and OpenID Connect
OAuth 2.0 and OpenID ConnectOAuth 2.0 and OpenID Connect
OAuth 2.0 and OpenID Connect
 
Microservices security - jpmc tech fest 2018
Microservices security - jpmc tech fest 2018Microservices security - jpmc tech fest 2018
Microservices security - jpmc tech fest 2018
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Último (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

OAuth with Salesforce - Demystified

  • 1. OAuth with Salesforce - Demystified calvin.noronha@bluewolf.com, @calvin_nr Calvin Noronha, Technical Architect at Bluewolf, an IBM company
  • 2. Agenda Introduction Authentication v/s Authorization Authorization - OAuth 2.0 Connected Apps Tokens, Client ID and Client secret OAuth scopes OAuth flows Demo – 1 Authentication - OpenID Connect OpenID providers OpenID Protocol OpenID response with ID token Demo – 2 Identity and Access Management Designer Certification Q&A
  • 4. Authentication v/s Authorization Pic1: https://i.imgur.com/y6dBO1Y.png Pic2:https://media.licdn.com/mpr/mpr/AAEAAQAAAAAAAAnMAAAAJDgxMTA4ODRkLWRiYzItNDZkYS05ZDI2LTY3MDFkNmM1NWNhMA.jpg Authentication Authorization Who you are? Example: Checking into a hotel at the front desk What you can do? Example: Hotel key card gives access to room, gym and pool
  • 5. Authentication  Authentication is a process of identifying a user based on a set of verifiable credentials such as a username and password.  In a client-server paradigm, a server validates the identity of a client either by itself or by forwarding the request to a trusted 3rd party provider.  Authentication determines if you are really who you say you are.  Identity Management
  • 6. Authorization  Authorization determines if a user has permission to access resources on the server post authentication.  During Authorization, the system verifies the access of an authenticated user and can: Grant access to protected resources Deny access  Authorization cannot occur without Authentication  Access Management
  • 8. What is OAuth? You may have seen options to login to websites using your Salesforce or social media credentials.
  • 9. An open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications. • (Official definition from OAuth.net) What does this mean? • Basically allows a user’s information to be used by a 3rd party service without exposing the user’s password. OAuth 2.0
  • 10. Why OAuth 2.0?  Security – Can you trust a 3rd party application with your password?  End users can authorize 3rd party applications with a click of a button.  OAuth can work securely with SSL so data transfer is protected.  Access to the resource server can be revoked easily.  As a developer, you no longer stored passwords inside source code!
  • 11. Roles in an OAuth flow
  • 12. Enter Tokens  “Tokens” do the actual heavy lifting in OAuth 2.0  Used instead of usernames and passwords to grant access to specified resources for a specified duration.  Three types: • Access – Short lived token which allows the application to access user data. In Salesforce, this is your session ID. • Refresh – Long lived token which can be used to acquire a new access token. Can be revoked. • ID token – This is related to OpenID Connect which we will review a bit later.
  • 13. Salesforce and OAuth 2.0  Salesforce provides extensive support for OAuth 2.0  Support began since Winter’11!  Around eight types of OAuth “flows” are supported by Salesforce as of Nov 2017.  You can easily access Salesforce API’s such as the REST API or Chatter API’s using OAuth.
  • 14. Connected App  This is a special kind of Salesforce App that allows us to access Salesforce API’s using OAuth 2.0.  Connected Apps do the following: • Authenticate • Provide Single Sign On • Acquire access tokens  You can provide the following information: • Redirect URL, Scope etc.  After configuring the Connected App, you will receive the Client Id and Client secret.  Control user access with Profiles and Permission sets.
  • 16. Client ID and Client secret  Any application that works with OAuth generally needs 2 pieces of information.  Client ID – This is a public identifier for your application. • Should be unique across all clients. • Best to be non-guessable. • Example: Salesforce - 3MVG9d8..z.hDcPK2PZTmDxggApSo.Cdd2H7ME9w6Yp6AUgEJeeCdkvXVLfpnFialOG.JQLmPFWxhSwcxV_A7  Client Secret – This is a secret value known only to the application and authorization server. • Should be used only in the web-server flow. • Never include this in a mobile or browser based app as it cannot be protected.
  • 17. OAuth Scopes  Scopes provide selective enabling of access to a user’s account based on required functionality.  In Salesforce, scopes control the types of resources available to an application. Some of the scopes are: api chatter_api full id refresh_token web
  • 18. OAuth access token request Parameters:  Code  Grant_type  Client_id  Client_secret  Redirect_url
  • 20. OAuth Flows in Salesforce  Web-Server flow  User-Agent flow  Username-Password flow  SAML Bearer Assertion flow  JWT Bearer Token flow
  • 21. Web-Server Flow  Used by web server applications which need to interact with Force.com API’s on behalf of a user.  These web apps run on a server where the code is not available publicly.  Higher degree of security because the client secret is protected.  Use when: You have a web application running on a server that can securely store the consumer secret.
  • 22. Web Server Flow Diagram taken from: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_web_server_oauth_flow.htm
  • 23. Other OAuth flows OAuth Flow Use Case User-Agent flow You have a client side mobile/browser application which cannot secure the client secret. Username-Password flow Used by applications that work without requiring user interaction to actively give authorization. SAML Bearer Assertion Flow A signed SAML 2.0 Assertion along with a digital signature can be used to obtain an OAuth access token. JWT Bearer Token Flow Server-to-server API integration uses JSON Web Token (JWT) to obtain an OAuth access token.
  • 24. Demo - 1  Use the Web Server OAuth flow to integrate an external website on Heroku with Salesforce.  Fetch and display recently modified Account records.  The demo will comprise of:  Quick walkthrough of the working solution  Step by step explanation of the OAuth flow  Understanding implications of OAuth scopes.  Explanation of the how the solution was built along with config and code walkthrough.  Built using:  Heroku  ForceTK library  HTML, CSS, Bootstrap
  • 26. OpenID Connect  OAuth 2.0 is great at providing Authorization. SAML is generally used for Single Sign On authentication.  OpenID Connect is a identity layer built on top of the OAuth 2.0 protocol.  It allows the verification of an end user using authentication performed by the Authorization server.  This is Authentication which is deeply integrated with Authorization.  Salesforce uses it to authenticate users across orgs and providers.
  • 28. Why not use OAuth 2.0 for Authentication?  OAuth 2.0 was designed for Authorization and identity is out of its scope.  Access token does not represent a user’s identity.  OpenID helps to implement single sign on.  OpenID Connect is OAuth Authorization + Authentication.
  • 29. OpenID Connect Protocol Diagram taken from: https://developer.salesforce.com/page/Inside_OpenID_Connect_on_Force.com
  • 30. OpenID Connect response Diagram taken from: https://developer.salesforce.com/page/Inside_OpenID_Connect_on_Force.com
  • 31. Demo - 2  Social Sign On into a Salesforce org using Google credentials with Google as the OpenID identity provider.  The demo will comprise of: • Quick walkthrough of the working solution • Understand how to easily set up an OpenID login to Salesforce. • Understanding the role of the Authentication Provider. • Explanation of the how the solution was built along with config and code walkthrough.
  • 32.  Part of the Architect designer certifications and is required to complete the “System Architect” Certification, a prerequisite for the Salesforce Certified Technical Architect (CTA).  Part of the #JourneyToCTA Identity and Access Management Designer Certification  Authentication and Authorization related concepts with Salesforce w.r.t to Single Sign On (SSO)  Understanding of the various Salesforce Identity features.  Knowledge of the different OAuth 2.0 flows.  Covers related security features such as 2FA and high assurance sessions.  http://bit.ly/2gqrama
  • 33. Further Reading URL Description http://sforce.co/2zypdaQ Learn more about Salesforce OAuth flows https://oauth.net/ Official OAuth website. http://sforce.co/2yKcNiB Certified Identity and Access Management Designer Certification. http://www.decodingthecloud.com My blog. http://bit.ly/2h4BSMf Access Salesforce API’s using JSForce. http://bit.ly/2ivxRUC Access Google API’s using OAuth 2.0 http://bit.ly/2xispH1 A tutorial about integrating Salesforce and LinkedIn using OAuth 2.0 http://bit.ly/2y2j8r6 Access the Fitbit API using OAuth 2.0 http://bit.ly/2ivNxHe The actual OAuth 2.0 protocol. http://sforce.co/2zypdaQ Best Salesforce article about OAuth 2.0 http://sforce.co/2iufb7s Identity and Access Management Trailhead trail.

Notas do Editor

  1. Oauth is a vast topic. “In the context of Salesforce” GOAL of the session is to understand the fundamentals.
  2. “Single Sign On” As the Force.com platform evolves, technologies related to integrations or single sign on solutions continue to change rapidly. Understanding how different applications can securely identify themselves to each other is key to building robust and secure application. Using passwords to login to a secure website or application is still the common method to “authenticate” users. “Authentication” and “Authorization” are two distinct concepts. IAM (Identity and Access Management) is one of the growing challenges in the Salesforce ecosystem.
  3. What if the app is hacked? Prevent users from revealing their passwords to the server or 3rd party systems. Instead login using your Google, Facebook, Twitter, Salesforce or LinkedIn etc. credentials.
  4. Best example is facebook game. “Client” – The Application attempting to access the user’s account. The user has to permit it to do so first. “Resource Server” – The server that hosts resources and user information. “Authorization Server” – The server that contains protected information. Generally same as the Resource server. “Owner” – The person who needs to give access to their account (User!)
  5. Talk about connected apps with LinkedIn, Google or Fitbit Call back URL (localhost v/s https) Scopes OAuth policies Trusted IP Ranges
  6. Scopes are for fine tuning the client application’s access to Salesforce on the user’s behalf.
  7. Most of the times u don’t see this as u use tools which abstract this.
  8. End goal is to get the access token
  9. Password is sent as part of the OAuth request. Therefore this should not be used unless absolutely necessary due to risks with exposing the password. Used by applications that work without requiring user interaction to actively give authorization.
  10. Moving away from permissions to Identity