SlideShare uma empresa Scribd logo
1 de 37
Mobile Authentication
Onboarding, best practices & anti-patterns
Pieter Ennes, co-founder Authentiq
authentiq.com
Who am I
• Pieter Ennes (@skion)

Co-founder Authentiq
• Authentication, identity, web
performance, web standards, not
the Higgs particle
2
authentiq.com
Authentiq
• Passwordless authentication via
OpenID Connect
• Trivial to integrate, privacy-
focused, configurable security
www.authentiq.com/developers
3
authentiq.com
Abstract
• We know and love our authentication standards for the web
• Yet many apps still resort to usernames & passwords on mobile 😱
• We explore OIDC and OAuth 2.0 in the context of mobile apps
• And learn how they promote simpler and more flexible patterns for
user authentication and API authorization
• So we can build user friendly, secure and future-proof native apps
4
authentiq.com
Anonymity goes a long way
• Social sharing
• Saving favourites or “likes”, search
history, shopping baskets
• Personalisation, managing user
preferences
• Backup / restores
9
authentiq.com
Avoid passwords
• Passwords have horrible UX on
mobile
• Passwords are reused, contain
little entropy, vulnerable to offline
attacks, …
• Passwords facilitate account
sharing
10
authentiq.com
Personal data is toxic
• Requesting deteriorates user
experience
• Retaining is risky business (e.g.
“right to forget”)
11
authentiq.com12
A happy user does not need to register.
authentiq.com13
Entering it twice does not make the user happier.
A happy user does not need a password.
authentiq.com14
GET /userinfo
A clever developer avoids sensitive information.
authentiq.com15
A clever developer uses web standards.
authentiq.com
OpenID Connect & OAuth 2.0
16
For authentication and authorization.
authentiq.com
These standards help us with…
• Authenticating a user (OIDC)
• Obtaining profile details from a user (OIDC)
• Issuing API tokens for backend (resource) servers (OAuth 2.0)
• Implementing passwordless and multi-factor authentication 

(OATH/TOTP, FIDO U2F/UAF)
• Managing account life cycles / account recovery
17
authentiq.com
OAuth 2.0
• Web authorisation framework to provide
limited access to web resources by 3rd party
clients
• Key Players
• Authorization Server (your internal or
external Identity Provider (IdP))
• Client (your website or app)
• Resource Owner (the user)
• Resource Server (the API to access)
18
authentiq.com
OpenID Connect (OIDC)
• An authentication layer on top of
OAuth 2.0
• Defines an ID Token, a signed JWT
with a consistent sub claim
• Standardises GET /userinfo
19
authentiq.com
ID Token
{
"iss": "https://server.example.com",
"sub": "24400320",
"aud": [“s6BhdRkqt3”, “https://my-api.server/"],
“exp": 1311281970,
"nonce": "n-0S6_WzA2Mj",
"iat": 1311280970,
"auth_time": 1311280969,
"acr": "urn:mace:incommon:iap:silver"
}
20
authentiq.com
Choosing an Authorization Server
21
Internal
Off-the-shelve
DEVELOPMENT COST: MEDIUM

SECURITY RISK: MEDIUM

LEVEL OF CONTROL: MEDIUM

LEVEL OF PRIVACY: HIGH

LEVEL OF SOVEREIGNTY: VARIABLE
Self-built
DEVELOPMENT COST: HIGH

SECURITY RISK: HIGH

LEVEL OF CONTROL: HIGH

LEVEL OF PRIVACY: HIGH

LEVEL OF SOVEREIGNTY: VARIABLE
External
Social
DEVELOPMENT COST: LOW

SECURITY RISK: LOW

LEVEL OF CONTROL: LOW

LEVEL OF PRIVACY: LOW

LEVEL OF SOVEREIGNTY: LOW
Dedicated
DEVELOPMENT COST: LOW

SECURITY RISK: LOW

LEVEL OF CONTROL: MEDIUM

LEVEL OF PRIVACY: MEDIUM/HIGH

LEVEL OF SOVEREIGNTY: VARIABLE
authentiq.com
Choosing an Authorization Server
22
Self-built Off-the-shelve Social Dedicated
Type Internal Internal External External
Sign in/up UX
User needs to enter
profile information
User needs to enter profile
information
User can share (part of)
existing profile
User can share (part of)
existing profile
Life cycle UX
Worry about account
recovery
Managed account life cycle Managed account life cycle Managed account life cycle
API Tokens Manage own API tokens Managed API tokens Managed API tokens Managed API tokens
Toxic data
Personal data stored on-
site
Personal data stored on-site Personal data stored at IdP Personal data stored at IdP
Privacy
Full control over user
tracking
Full control over user tracking Risk of external user tracking
Variable control over user
tracking
Security Passwords Passwordless, 2FA, … Passwordless, 2FA, … Passwordless, 2FA, …
authentiq.com
OpenID Connect & OAuth 2.0
23
For mobile apps.
authentiq.com
Mobile OAuth Recipe
1.Register app as a public client at IdP
2.Register your redirect URI as a Universal Link
3.Don’t use an embedded browser
4.Don’t use the implicit flow
5.Protect the authorization code (using PKCE)
24
authentiq.com
Register app as a public client
• Client doesn’t authenticate to the server; no client secret
• Client needs to register the full redirect URI
• Client should use measures to protect the authorization code
25
authentiq.com
Register your inter-app redirect URL
• Custom URI schemes



com.your.app:/authorized/<provider>
• Universal Links



https://ul.your-domain.example/authorized/<provider>
• Loopback redirects



http://127.0.0.1:50719/authorized/<provider>
26
authentiq.com
Don’t use an embedded browser
• An embedded WebView allows app to read the user’s credentials
• An external user agent facilitates single sign-on (SSO)
• App/Play stores might scan for this in the future
27
authentiq.com
Don’t use the implicit flow
• Might seem appropriate for a
public client, but…
• No refresh token, so user needs
to re-authenticate
• Other apps might hijack the
returned tokens
28
No client
secret! But…
authentiq.com
Protect the authorization code
• Another app might intercept the authorization code
• Proof Key for Code Exchange (RFC 7636)
• Pass in the (partial) hash of a secret to the /authorize request



GET /authorize?response_type=code&code_challenge=AAA
• Then present the full secret to the /token request



POST /token

grant_type=authorization_code&client_id=YYY&code=ZZZ&code_verifier=BBB
• Required for public clients on mobile devices
29
authentiq.com
We now have
• An ID Token, to identify the user
• An Access Token, to retrieve their profile
• A Refresh Token, to renew expired access tokens
30
authentiq.com
API Authorization
31
Authorization: Bearer {access_token}
authentiq.com
Two types of Bearer tokens
• By introspection, using opaque tokens (RFC 7662)
• Resource server needs to call the token issuer for validation
• Tokens can be revoked
• Via JWT validation, using structured tokens (RFC 7519)
• Resource server only needs public key of the token issuer
• Tokens can’t be revoked
32
authentiq.com
Token introspection (RFC7662)
• Resource server asks the IdP whether a token is (still) valid
• POST /introspect

token=abcdefg

{
"active": true,
"client_id": "l238j323ds-23ij4",
"username": "jdoe",
"scope": "read write dolphin",
"sub": “Z5O3upPC88QrAjx00dis",
"aud": "https://protected.example.net/resource",
"iss": "https://server.example.com/",
"exp": 1419356238,
"iat": 1419350238,
"extension_field": "twenty-seven"
}
33
authentiq.com
JWT Token validation
• Token is a JWT containing sub, aud, iss claims
• Obtain the public key of the IdP



Probably from /.well-known/openid-configuration
• Validate it locally with favourite language



claims = jwt.decode(token, issuer_public_key, 

audience=“https://my-api-server/",

allowed_algorithms=[“RS256”])
34
authentiq.com
Conclusion
• Good and bad onboarding patterns
• OIDC for authentication
• OAuth 2.0 for API Authorization
• Future talk: User Managed Access (UMA)
35
Questions?
Thank you
https://www.authentiq.com/

Mais conteúdo relacionado

Mais procurados

electronic_payment_system_in_korea_eng
electronic_payment_system_in_korea_engelectronic_payment_system_in_korea_eng
electronic_payment_system_in_korea_eng
Frank Mercado
 
Eco [3 c] introduction of national pki-sg-jaejung kim-15_apr10
Eco [3 c] introduction of national pki-sg-jaejung kim-15_apr10Eco [3 c] introduction of national pki-sg-jaejung kim-15_apr10
Eco [3 c] introduction of national pki-sg-jaejung kim-15_apr10
Hai Nguyen
 

Mais procurados (20)

ForgeRock and Trusona - Simplifying the Multi-factor User Experience
ForgeRock and Trusona - Simplifying the Multi-factor User ExperienceForgeRock and Trusona - Simplifying the Multi-factor User Experience
ForgeRock and Trusona - Simplifying the Multi-factor User Experience
 
Best practices in Certifying and Signing PDFs
Best practices in Certifying and Signing PDFsBest practices in Certifying and Signing PDFs
Best practices in Certifying and Signing PDFs
 
2017.03.30 - e-Signatures Conference for ZertES and eIDAS
2017.03.30 - e-Signatures Conference for ZertES and eIDAS 2017.03.30 - e-Signatures Conference for ZertES and eIDAS
2017.03.30 - e-Signatures Conference for ZertES and eIDAS
 
eIDAS Reference Guide
eIDAS Reference GuideeIDAS Reference Guide
eIDAS Reference Guide
 
Role of a Qualified Trust Service Provider in Europe
Role of a Qualified Trust Service Provider in EuropeRole of a Qualified Trust Service Provider in Europe
Role of a Qualified Trust Service Provider in Europe
 
electronic_payment_system_in_korea_eng
electronic_payment_system_in_korea_engelectronic_payment_system_in_korea_eng
electronic_payment_system_in_korea_eng
 
OpenID Foundation MODRNA WG Update
OpenID Foundation MODRNA WG UpdateOpenID Foundation MODRNA WG Update
OpenID Foundation MODRNA WG Update
 
A deep walk on the dark side of information security
A deep walk on the dark side of information securityA deep walk on the dark side of information security
A deep walk on the dark side of information security
 
FIDO Authentication: Its Evolution and Opportunities in Business -FIDO Allian...
FIDO Authentication: Its Evolution and Opportunities in Business -FIDO Allian...FIDO Authentication: Its Evolution and Opportunities in Business -FIDO Allian...
FIDO Authentication: Its Evolution and Opportunities in Business -FIDO Allian...
 
Digital authentication
Digital authenticationDigital authentication
Digital authentication
 
Inside Security - Strong Authentication with Smartphones
Inside Security - Strong Authentication with SmartphonesInside Security - Strong Authentication with Smartphones
Inside Security - Strong Authentication with Smartphones
 
Consumer identity @ Tuesday Update on 1 December 2009
Consumer identity @ Tuesday Update on 1 December 2009Consumer identity @ Tuesday Update on 1 December 2009
Consumer identity @ Tuesday Update on 1 December 2009
 
Eurosmart presentation on the eidas regulation
Eurosmart presentation on the eidas regulationEurosmart presentation on the eidas regulation
Eurosmart presentation on the eidas regulation
 
Implementing Open Banking with ForgeRock
Implementing Open Banking with ForgeRockImplementing Open Banking with ForgeRock
Implementing Open Banking with ForgeRock
 
Eco [3 c] introduction of national pki-sg-jaejung kim-15_apr10
Eco [3 c] introduction of national pki-sg-jaejung kim-15_apr10Eco [3 c] introduction of national pki-sg-jaejung kim-15_apr10
Eco [3 c] introduction of national pki-sg-jaejung kim-15_apr10
 
Digital ID Protocol - Presentation 2015-12-04
Digital ID Protocol - Presentation 2015-12-04Digital ID Protocol - Presentation 2015-12-04
Digital ID Protocol - Presentation 2015-12-04
 
Frictionless Adaption of PSD2 with WSO2
Frictionless Adaption of PSD2 with WSO2Frictionless Adaption of PSD2 with WSO2
Frictionless Adaption of PSD2 with WSO2
 
apidays LIVE Singapore - Engineering Open Banking with Singpass for Financial...
apidays LIVE Singapore - Engineering Open Banking with Singpass for Financial...apidays LIVE Singapore - Engineering Open Banking with Singpass for Financial...
apidays LIVE Singapore - Engineering Open Banking with Singpass for Financial...
 
Strong Customer Authentication & Biometrics
Strong Customer Authentication & BiometricsStrong Customer Authentication & Biometrics
Strong Customer Authentication & Biometrics
 
Telia - The New Norm of the Digital World
Telia - The New Norm of the Digital WorldTelia - The New Norm of the Digital World
Telia - The New Norm of the Digital World
 

Semelhante a Mobile Authentication - Onboarding, best practices & anti-patterns

Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Aaron Parecki
 

Semelhante a Mobile Authentication - Onboarding, best practices & anti-patterns (20)

Intro to OAuth2 and OpenID Connect
Intro to OAuth2 and OpenID ConnectIntro to OAuth2 and OpenID Connect
Intro to OAuth2 and OpenID Connect
 
FIWARE Tech Summit - Complete Framework for Identity, Access Control and API ...
FIWARE Tech Summit - Complete Framework for Identity, Access Control and API ...FIWARE Tech Summit - Complete Framework for Identity, Access Control and API ...
FIWARE Tech Summit - Complete Framework for Identity, Access Control and API ...
 
OAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring BootOAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring Boot
 
Spring4 security oauth2
Spring4 security oauth2Spring4 security oauth2
Spring4 security oauth2
 
Spring4 security oauth2
Spring4 security oauth2Spring4 security oauth2
Spring4 security oauth2
 
Introduction to the Globus Platform for Developers
Introduction to the Globus Platform for DevelopersIntroduction to the Globus Platform for Developers
Introduction to the Globus Platform for Developers
 
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
 
Secure your app with keycloak
Secure your app with keycloakSecure your app with keycloak
Secure your app with keycloak
 
Stateless Auth using OAuth2 & JWT
Stateless Auth using OAuth2 & JWTStateless Auth using OAuth2 & JWT
Stateless Auth using OAuth2 & JWT
 
ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2
 
OAuth 2.0 and OpenID Connect
OAuth 2.0 and OpenID ConnectOAuth 2.0 and OpenID Connect
OAuth 2.0 and OpenID Connect
 
Spring security oauth2
Spring security oauth2Spring security oauth2
Spring security oauth2
 
Stateless Auth using OAUTH2 & JWT
Stateless Auth using OAUTH2 & JWTStateless Auth using OAUTH2 & JWT
Stateless Auth using OAUTH2 & JWT
 
Securing SharePoint Apps with OAuth
Securing SharePoint Apps with OAuthSecuring SharePoint Apps with OAuth
Securing SharePoint Apps with OAuth
 
Linkedin & OAuth
Linkedin & OAuthLinkedin & OAuth
Linkedin & OAuth
 
Introduction to sitecore identity
Introduction to sitecore identityIntroduction to sitecore identity
Introduction to sitecore identity
 
Auth proxy pattern on Kubernetes
Auth proxy pattern on KubernetesAuth proxy pattern on Kubernetes
Auth proxy pattern on Kubernetes
 
De la bonne utilisation de OAuth2
De la bonne utilisation de OAuth2 De la bonne utilisation de OAuth2
De la bonne utilisation de OAuth2
 
Securing .NET Core, ASP.NET Core applications
Securing .NET Core, ASP.NET Core applicationsSecuring .NET Core, ASP.NET Core applications
Securing .NET Core, ASP.NET Core applications
 
Adding identity management and access control to your app
Adding identity management and access control to your appAdding identity management and access control to your app
Adding identity management and access control to your app
 

Último

Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Cara Menggugurkan Kandungan 087776558899
 

Último (8)

Leading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfLeading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdf
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and Layouts
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s Tools
 
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
 
Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & Examples
 
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
 
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
 
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
 

Mobile Authentication - Onboarding, best practices & anti-patterns

  • 1. Mobile Authentication Onboarding, best practices & anti-patterns Pieter Ennes, co-founder Authentiq
  • 2. authentiq.com Who am I • Pieter Ennes (@skion)
 Co-founder Authentiq • Authentication, identity, web performance, web standards, not the Higgs particle 2
  • 3. authentiq.com Authentiq • Passwordless authentication via OpenID Connect • Trivial to integrate, privacy- focused, configurable security www.authentiq.com/developers 3
  • 4. authentiq.com Abstract • We know and love our authentication standards for the web • Yet many apps still resort to usernames & passwords on mobile 😱 • We explore OIDC and OAuth 2.0 in the context of mobile apps • And learn how they promote simpler and more flexible patterns for user authentication and API authorization • So we can build user friendly, secure and future-proof native apps 4
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. authentiq.com Anonymity goes a long way • Social sharing • Saving favourites or “likes”, search history, shopping baskets • Personalisation, managing user preferences • Backup / restores 9
  • 10. authentiq.com Avoid passwords • Passwords have horrible UX on mobile • Passwords are reused, contain little entropy, vulnerable to offline attacks, … • Passwords facilitate account sharing 10
  • 11. authentiq.com Personal data is toxic • Requesting deteriorates user experience • Retaining is risky business (e.g. “right to forget”) 11
  • 12. authentiq.com12 A happy user does not need to register.
  • 13. authentiq.com13 Entering it twice does not make the user happier. A happy user does not need a password.
  • 14. authentiq.com14 GET /userinfo A clever developer avoids sensitive information.
  • 15. authentiq.com15 A clever developer uses web standards.
  • 16. authentiq.com OpenID Connect & OAuth 2.0 16 For authentication and authorization.
  • 17. authentiq.com These standards help us with… • Authenticating a user (OIDC) • Obtaining profile details from a user (OIDC) • Issuing API tokens for backend (resource) servers (OAuth 2.0) • Implementing passwordless and multi-factor authentication 
 (OATH/TOTP, FIDO U2F/UAF) • Managing account life cycles / account recovery 17
  • 18. authentiq.com OAuth 2.0 • Web authorisation framework to provide limited access to web resources by 3rd party clients • Key Players • Authorization Server (your internal or external Identity Provider (IdP)) • Client (your website or app) • Resource Owner (the user) • Resource Server (the API to access) 18
  • 19. authentiq.com OpenID Connect (OIDC) • An authentication layer on top of OAuth 2.0 • Defines an ID Token, a signed JWT with a consistent sub claim • Standardises GET /userinfo 19
  • 20. authentiq.com ID Token { "iss": "https://server.example.com", "sub": "24400320", "aud": [“s6BhdRkqt3”, “https://my-api.server/"], “exp": 1311281970, "nonce": "n-0S6_WzA2Mj", "iat": 1311280970, "auth_time": 1311280969, "acr": "urn:mace:incommon:iap:silver" } 20
  • 21. authentiq.com Choosing an Authorization Server 21 Internal Off-the-shelve DEVELOPMENT COST: MEDIUM SECURITY RISK: MEDIUM LEVEL OF CONTROL: MEDIUM LEVEL OF PRIVACY: HIGH LEVEL OF SOVEREIGNTY: VARIABLE Self-built DEVELOPMENT COST: HIGH SECURITY RISK: HIGH LEVEL OF CONTROL: HIGH LEVEL OF PRIVACY: HIGH LEVEL OF SOVEREIGNTY: VARIABLE External Social DEVELOPMENT COST: LOW SECURITY RISK: LOW LEVEL OF CONTROL: LOW LEVEL OF PRIVACY: LOW LEVEL OF SOVEREIGNTY: LOW Dedicated DEVELOPMENT COST: LOW SECURITY RISK: LOW LEVEL OF CONTROL: MEDIUM LEVEL OF PRIVACY: MEDIUM/HIGH LEVEL OF SOVEREIGNTY: VARIABLE
  • 22. authentiq.com Choosing an Authorization Server 22 Self-built Off-the-shelve Social Dedicated Type Internal Internal External External Sign in/up UX User needs to enter profile information User needs to enter profile information User can share (part of) existing profile User can share (part of) existing profile Life cycle UX Worry about account recovery Managed account life cycle Managed account life cycle Managed account life cycle API Tokens Manage own API tokens Managed API tokens Managed API tokens Managed API tokens Toxic data Personal data stored on- site Personal data stored on-site Personal data stored at IdP Personal data stored at IdP Privacy Full control over user tracking Full control over user tracking Risk of external user tracking Variable control over user tracking Security Passwords Passwordless, 2FA, … Passwordless, 2FA, … Passwordless, 2FA, …
  • 23. authentiq.com OpenID Connect & OAuth 2.0 23 For mobile apps.
  • 24. authentiq.com Mobile OAuth Recipe 1.Register app as a public client at IdP 2.Register your redirect URI as a Universal Link 3.Don’t use an embedded browser 4.Don’t use the implicit flow 5.Protect the authorization code (using PKCE) 24
  • 25. authentiq.com Register app as a public client • Client doesn’t authenticate to the server; no client secret • Client needs to register the full redirect URI • Client should use measures to protect the authorization code 25
  • 26. authentiq.com Register your inter-app redirect URL • Custom URI schemes
 
 com.your.app:/authorized/<provider> • Universal Links
 
 https://ul.your-domain.example/authorized/<provider> • Loopback redirects
 
 http://127.0.0.1:50719/authorized/<provider> 26
  • 27. authentiq.com Don’t use an embedded browser • An embedded WebView allows app to read the user’s credentials • An external user agent facilitates single sign-on (SSO) • App/Play stores might scan for this in the future 27
  • 28. authentiq.com Don’t use the implicit flow • Might seem appropriate for a public client, but… • No refresh token, so user needs to re-authenticate • Other apps might hijack the returned tokens 28 No client secret! But…
  • 29. authentiq.com Protect the authorization code • Another app might intercept the authorization code • Proof Key for Code Exchange (RFC 7636) • Pass in the (partial) hash of a secret to the /authorize request
 
 GET /authorize?response_type=code&code_challenge=AAA • Then present the full secret to the /token request
 
 POST /token
 grant_type=authorization_code&client_id=YYY&code=ZZZ&code_verifier=BBB • Required for public clients on mobile devices 29
  • 30. authentiq.com We now have • An ID Token, to identify the user • An Access Token, to retrieve their profile • A Refresh Token, to renew expired access tokens 30
  • 32. authentiq.com Two types of Bearer tokens • By introspection, using opaque tokens (RFC 7662) • Resource server needs to call the token issuer for validation • Tokens can be revoked • Via JWT validation, using structured tokens (RFC 7519) • Resource server only needs public key of the token issuer • Tokens can’t be revoked 32
  • 33. authentiq.com Token introspection (RFC7662) • Resource server asks the IdP whether a token is (still) valid • POST /introspect
 token=abcdefg
 { "active": true, "client_id": "l238j323ds-23ij4", "username": "jdoe", "scope": "read write dolphin", "sub": “Z5O3upPC88QrAjx00dis", "aud": "https://protected.example.net/resource", "iss": "https://server.example.com/", "exp": 1419356238, "iat": 1419350238, "extension_field": "twenty-seven" } 33
  • 34. authentiq.com JWT Token validation • Token is a JWT containing sub, aud, iss claims • Obtain the public key of the IdP
 
 Probably from /.well-known/openid-configuration • Validate it locally with favourite language
 
 claims = jwt.decode(token, issuer_public_key, 
 audience=“https://my-api-server/",
 allowed_algorithms=[“RS256”]) 34
  • 35. authentiq.com Conclusion • Good and bad onboarding patterns • OIDC for authentication • OAuth 2.0 for API Authorization • Future talk: User Managed Access (UMA) 35