SlideShare a Scribd company logo
06/10/2020
Warsaw MuleSoft Meetup Group
JSON Web Token demystified
2
● Introductions & Community Updates
● Introduction to JWT
● JSON Validation Policy
● Consuming service with JWT validation policy
● Quiz & Lottery
● What’s next & Close
Agenda
Introduction
Our partners
4
5
● Subject Matter Expert at PwC Poland
● MuleSoft Ambassador
● MuleSoft Meetup Leader for Warsaw, Poland
● Working with MuleSoft products for over 8 years now
● One of Salesforce Trailblazers
https://trailhead.salesforce.com/trailblazers/patryk-bandurski
Organizer / Speaker
Check out my integration blog
https://ambassadorpatryk.com/blog
Share the event
6
● Share the Meetup in your social media
● Use Hashtags
#MuleSoftMeetup
#WarsawMuleSoftMeetup
Thanks 
MuleSoft Connect:Now
Community Updated
8
MuleSoft CONNECT:Now
MuleSoft CONNECT:Now is a virtual experience bringing you a
full program of technical sessions and content, streamed online
for free!
Register for free: https://connect.mulesoft.com
9
Developer Meetups at CONNECT:Now events
Meet the MuleSoft Community!
● Hear technical use cases from customer and
partner MuleSoft experts around the globe
● Live chat with MuleSoft Ambassadors!
JOIN ONLINE FOR FREE:
EMEA: October 8, 2020
AMER: October 13, 2020
APAC: October 20, 2020
Register: https://connect.mulesoft.com/
Check out the technical presentations below:
Developer Meetup at CONNECT:Now EMEA
● Twitter
○ Felipe Ocadiz, MuleSoft Ambassador, IT Integration Engineer
○ How to become an Anypoint Studio ninja
● Saint-Gobain
○ Francis Edwards, MuleSoft Ambassador, Integration Analyst
○ Useful integration tools
JOIN FOR FREE: October 8, 2020 (10:30am-11:15am BST)
Register: https://connect.mulesoft.com/events/connect/emea
Check out the technical presentations below:
Developer Meetup at CONNECT:Now Americas
● AT&T
○ Brad Ringer, Principal System Engineer
○ MuleSoft Runtime Fabric: The road to success
● MuleSoft Ambassadress
○ Alexandra Martinez, Sr. MuleSoft Developer, Bits in Glass
○ Reviewing a complex DataWeave transformation
JOIN FOR FREE: October 13, 2020 (10:30am-11:15am PDT)
Register: https://connect.mulesoft.com/events/connect/amer
Check out the technical presentations below:
Developer Meetup at CONNECT:Now JAPAC
● Datacom
○ Mary Joy Sabal, Sr. Integration Developer
○ Using Maven Archetypes to create MuleSoft API Project Templates
● MuleSoft Ambassador
○ Sravan Lingam, Consultant, Virtusa
○ Create a virtual Tic-Tac-Toe game using Object Store v2
JOIN FOR FREE: October 20, 2020 (2:30pm-3:15pm AEDT)
Register: https://connect.mulesoft.com/events/connect/japac
13
Follow Mariana Lemus on
LinkedIn
MuleSoft Ambassadors
● People to learn from
● Active in the MuleSoft
Community
● Worth following
● 20 MuleSoft
Ambassadors:
https://developer.mules
oft.com/dev/ambassado
rs
14
● MuleSoft Partner Calendar
MuleSoft Partnership
● Free online tutored Development Fundamentals available now!
● Visit Partnership Calendar https://www.mulesoft.com/integration-partner/program/calendar
● Other interesting calendars:
15
Introduction
JSON Web Token Demystyfied
JSON Web Token
„JSON web token (JWT), pronounced "jot", is an
open standard (RFC 7519) that defines a
compact and self-contained way for securely
transmitting information between parties as a
JSON object. Again, JWT is a standard, meaning
that all JWTs are tokens, but not all tokens are
JWTs.” Auth0 Docs
https://tools.ietf.org/html/rfc7515
JWS Structure
● JOSE Header
○ Algorithm used to sign
● Payload
○ Claims – statements about caller/user. We have registered claims, public claims and
private claims.
● Signature
○ Signed encoded header and payload parts
18
Payload part of JWS
19
Claim
property
Claim name Description Example
iss Issuer Issuer of the JWT Me
sub Subject Subject of the JWT (the user) Bob
aud Audience Recipient for which the JWT is intended https://api.ambassadorpatryk.co
m
nbf Not Before Time before which the JWT must not be accepted for
processing. Unix timestamp.
1516239022
iat Issued At Time at which the JWT was issued; can be used to
determine age of the JWT. Unix timestamp.
1516239022
id Id Unique identifier; can be used to prevent the JWT
from being replayed (allows a token to be used only
once)
b32737dc-adb0-4faf-8e38-
7d0478f18a2e
exp Expiration Time identifies the expiration time on
or after which the JWT MUST NOT be accepted for
processing. Unix timestamp.
1516239022
Signature
base64urlEncoded(Header) + „.” +
base64urlEncoded(Payload)
20
JWT Validation Policy
JWT Validation Policy
● Supports
○ RS256, RS384, RS512 (RSA)
○ HS256, HS384, HS512 (HMAC)
● Supports registered claims and custom claims
● JWT Key
○ Static private value
○ Dynamicaly retrieved from JWKS
● Read more -> https://docs.mulesoft.com/api-manager/2.x/policy-mule4-jwt-validation
22
RSA256 with extra validation
• Registered claims
• Private claims (mandatory, not mandatory)
DEMO
Setup JWT validation policy
[DEMO] JWT Validation Policy
Configuration
● Authorization header
● RSA 256 signing algorithm
● Public key static in policy
24
[DEMO] JWT Validation Policy
Configuration
● Do not validate client id
● Validate audience (aud)
○ Expected values one of
■ pl-lb.anypointdns.com
■ Api.patrykbandurski.com
■ test.patrykbandurski.com
● Expiration (exp) is mandatory
● Apply to all methods and resources
25
[DEMO] JWT Validation Policy
Generate JWS and place it in authorization header
400 Bad Request – no authorization header
401 Unauthorized – wrong token
26
[DEMO] JWT Validation Policy
27
[jwt-validation-1111044-sfdc-jwt-xapi-main].1111044-client-id-enforcementDEBUG
event:d87e0230-064c-11eb-a171-066db5e9ec56 Token was parsed successfully.
[jwt-validation-1111044-sfdc-jwt-xapi-main].1111044-client-id-enforcementDEBUG
event:d87e0230-064c-11eb-a171-066db5e9ec56 Ready to validate the signature of the token.
[jwt-validation-1111044-sfdc-jwt-xapi-main].1111044-client-id-enforcementDEBUG
event:d87e0230-064c-11eb-a171-066db5e9ec56 Token signature successfully validated.
[jwt-validation-1111044-sfdc-jwt-xapi-main].1111044-client-id-enforcementDEBUG
event:d87e0230-064c-11eb-a171-066db5e9ec56 Validating aud claim.
[jwt-validation-1111044-sfdc-jwt-xapi-main].1111044-client-id-enforcementDEBUG
event:d87e0230-064c-11eb-a171-066db5e9ec56 The server did not identify with the any of the
audiences '[aapi.patrykbandurski.com].'
DEBUG com.mulesoft.extension.policies.jwt on logging
[DEMO] JWT Validation Policy
28
● jwt.io
● Generate token
● Aud, iat, exp
● Public & private
key
● Remember! Do
not use online
tools to generate
[DEMO] JWT Validation Policy
29
● Required and optional
private claims
● Static comparison
● Complex expression with
DataWeave
Required claim email is not present in the JWT. Token will be rejected.
[DEMO] JWT Validation Policy
30
● Non mandatory claims.
○ Validate when claim name prasent
○ Can be complex – DataWeave – example
roles is an Array haveing at least one item.
Available values are USER, ADMIN or
CONTRIBUTOR
○ Refer to claim via vars.claimSet.[claim-
name]
In case of failed condition, this will be saved in the log file "Condition ... not
met"
JWKS (JSON Web Keys Set)
● Set of keys contains the public keys
used to verify any JWT
● JWK (JSON Web Key) – JSON
object representing a cryptographic
key
● Rotation of the keys at ease
● Key retrieved dynamically
31
JWK
{
"kty": "RSA",
"e": "AQAB",
"alg": "RS256",
"kid": "uniqueid",
"n": "lgyuFifEOODgA4rZP2gQUunm_nM4G5a9aHoLkEosrMPuD4
LClPbke9nn0LUJ4H-M_3rX9-
yXhjzhjrduUDcImVMBATN7UsYOxYOZvqUjRf72y1eNjIWMnLBCWB
uQZrhqN73ttCOJLg28llI-
65XDfd6qeOlSlGWQD1YSGjX8cHDXoADXOpKrwPZy1ghkJMMtsvFx
QNJd8hVvmzPlq-jefOXFOcsBjCB-
QQkA3Lty0dScKPKfFQVooZxVhqU_r2wrSvviAdl8pN5yKmhcmT9S
9Ke-mfpJXOnYB9y3Z9xRb0RFQBhrDBLNEc1TDCeRX2RZ-
A9pUJ0IbG-b-rFlQYjNOw"
}
32
Working with JWKS
● Provide url to JWKS – publicly available
● 503 Service Unavailable– JWKS is not accessible
● 401 Unauthorized – signing error
33
RSA256 using JSON Web Keys Set
DEMO
Setup JWT validation policy
[DEMO] JWT Validation Policy - JWKS
● JWKS service
● Standard which allows customer
to rated public keys
35
[DEMO] JWT Validation Policy - JWKS
● URL to JWKS
36
[DEMO] JWT Validation Policy - JWKS
{
"keys": [
{
"kty": "RSA",
"e": "AQAB",
"alg": "RS256",
"kid": "uniqueid",
"n": "…"
}
]
}
37
JSON Web Keys Set:
Consume 3rd party service with
JWT Validation Policy
Generating JWS in Mule
● No native support in MuleSoft
● Salesforce OAuth JWT authentication mechanism
● Custom code:
○ JAVA
■ JJWT library https://github.com/jwtk/jjwt
○ Ruby
■ ruby-jwt library https://github.com/jwt/ruby-jwt
● Mule Custom Component:
○ JWT Component Extension https://github.com/dyeeye/jwt-component
JJWT sample code
JwtBuilder builder = Jwts.builder() // (1)
.setIssuer(claims.getIssuer()) // (2)
.setSubject(claims.getSubject())
.setAudience(claims.getAudience())
.setNotBefore(claims.getNotBefore())
.setIssuedAt(claims.getIssuedAt())
.setId(claims.getId());
String jws = builder
.signWith(privKey, SignatureAlgorithm.valueOf(algorithm)) // (3)
.compact(); // (4)
40
JWT Component
● Supports signing algorithms
○ RSA 256, 384 and 512
○ HMAC 256, 384 and 512
● Claims
○ Registered
○ Private
● Visual support in Anypoint Studio
● Reads keystore from classpath
41
Service secured with JWT Validation Policy RSA
DEMO
Consume service
[DEMO] Generating JWT
43
[DEMO] Generating JWT
● Removed expected expiration claim
● 401 in return
44
Questions?
Quiz
Trivia Quiz
● Quiz parts:
○ Three warm-up questions (you won’t get point from
them)
○ Five questions (for points)
● Remember!
○ The quicker you respond more point you earn
○ Only good answers count 
47
Three winners of today’s
quiz receives:
Free voucher for MuleSoft
online training and exam
Lottery
● How it works?
○ I call API that selects randomly three winners
among checked-in attendees.
○ I will ask winners by Name & Surname for the
email
● Remember!
○ Prize is sponsored by
48
Three winners of today’s
lottery receives:
Amazon Voucher for 50$
Congratulation
● Congratulation to all the winners
○ of the Quiz
○ of the lottery
● Remember to send your email
address to the organizer via chat
window!
49
Wrap up
Share your knowledge
● Become a speaker and share your knowledge with our community
● Submit your idea via this form:
https://tinyurl.com/become-speaker
via email patryk.bandurski@gmail.com
or
51
52
● Share:
○ Tweet using the hashtag #MuleSoftMeetups
○ Invite your network to join: https://meetups.mulesoft.com/warsaw/
● Feedback:
○ Fill out the survey feedback and suggest topics for upcoming events
○ Contact MuleSoft at meetups@mulesoft.com for ways to improve the program
What’s next?
See you next time

More Related Content

PPTX
MuleSoft Integration with AWS Cognito Client Credentials and Mule JWT Validat...
PPTX
OpenId Connect Protocol
PPTX
OpenStack Architecture and Use Cases
PDF
Secure Spring Boot Microservices with Keycloak
PPTX
Rabbit MQ introduction
PPTX
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB Architecture
PDF
Json web token
PDF
Open stack
MuleSoft Integration with AWS Cognito Client Credentials and Mule JWT Validat...
OpenId Connect Protocol
OpenStack Architecture and Use Cases
Secure Spring Boot Microservices with Keycloak
Rabbit MQ introduction
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB Architecture
Json web token
Open stack

What's hot (20)

PDF
Introduction to WebSockets Presentation
PPTX
Json Web Token - JWT
PPTX
Secure your app with keycloak
PDF
VPCs, Metrics Framework, Back pressure : MuleSoft Virtual Muleys Meetups
PDF
Modern API Security with JSON Web Tokens
PDF
API Trends & Use Cases
PDF
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
PPTX
OAuth 2
PPTX
NGINX: High Performance Load Balancing
PDF
Linux Networking Explained
PPTX
Designing Apps for Runtime Fabric: Logging, Monitoring & Object Store Persist...
PPTX
OpenID for Verifiable Credentials
PDF
JSON Web Token
PDF
An introduction to SSH
PDF
Introduction to Docker Compose
PDF
Introduction to Microsoft Azure Cloud
PPTX
Keystone - Openstack Identity Service
PDF
Software Defined Datacenter with Proxmox
PDF
Mastering OpenStack - Episode 01 - Simple Architectures
PPTX
Docker Container Security
Introduction to WebSockets Presentation
Json Web Token - JWT
Secure your app with keycloak
VPCs, Metrics Framework, Back pressure : MuleSoft Virtual Muleys Meetups
Modern API Security with JSON Web Tokens
API Trends & Use Cases
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
OAuth 2
NGINX: High Performance Load Balancing
Linux Networking Explained
Designing Apps for Runtime Fabric: Logging, Monitoring & Object Store Persist...
OpenID for Verifiable Credentials
JSON Web Token
An introduction to SSH
Introduction to Docker Compose
Introduction to Microsoft Azure Cloud
Keystone - Openstack Identity Service
Software Defined Datacenter with Proxmox
Mastering OpenStack - Episode 01 - Simple Architectures
Docker Container Security
Ad

Similar to MuleSoft JWT Demystified (20)

PPTX
Warsaw muleSoft meetup #11 MuleSoft OData
PPTX
Heroku - A ployglot Platform (Add-on)
PPTX
Architect Track Heroku - A Polyglot Platform [Architecture & Add-ons]By Ashis...
PDF
Camille chaudet measure camp-tagguing_mobile_apps_june15_v1.0
PDF
Sydney MuleSoft Meetup #16 - 19 November 2020
PDF
2016 pycontw web api authentication
PPTX
Microservices Security Landscape
PDF
Microservices Security Landscape
PPTX
Warsaw MuleSoft Meetup #13.pptx
PDF
Sputnik dlt
PDF
Using JSON Web Tokens for REST Authentication
DOCX
Tshepo morailane(resume)
PPTX
Warsaw MuleSoft Meetup #12 Effective Streaming
PDF
Himmelstein SP Connections HAD207 SharePoint Logging & Debugging
PDF
WebGoat.SDWAN.Net in Depth
PDF
WebGoat.SDWAN.Net in Depth: SD-WAN Security Assessment
PDF
Docker Monitoring Webinar
PDF
Webrtc 동향과 이슈 2016.08
PDF
Melbourne Virtual MuleSoft Meetup November 2020
PPTX
Unleash MuleSoft Platform for Enterprise Healthcare Solutions
Warsaw muleSoft meetup #11 MuleSoft OData
Heroku - A ployglot Platform (Add-on)
Architect Track Heroku - A Polyglot Platform [Architecture & Add-ons]By Ashis...
Camille chaudet measure camp-tagguing_mobile_apps_june15_v1.0
Sydney MuleSoft Meetup #16 - 19 November 2020
2016 pycontw web api authentication
Microservices Security Landscape
Microservices Security Landscape
Warsaw MuleSoft Meetup #13.pptx
Sputnik dlt
Using JSON Web Tokens for REST Authentication
Tshepo morailane(resume)
Warsaw MuleSoft Meetup #12 Effective Streaming
Himmelstein SP Connections HAD207 SharePoint Logging & Debugging
WebGoat.SDWAN.Net in Depth
WebGoat.SDWAN.Net in Depth: SD-WAN Security Assessment
Docker Monitoring Webinar
Webrtc 동향과 이슈 2016.08
Melbourne Virtual MuleSoft Meetup November 2020
Unleash MuleSoft Platform for Enterprise Healthcare Solutions
Ad

More from Patryk Bandurski (17)

PPTX
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
PPTX
CI/CD Practices in MuleSoft – CloudHub 1 vs CloudHub 2
PDF
Warsaw MuleSoft Meetup - Agentforce Community Tour.pdf
PPTX
Warsaw MuleSoft Meetup - Composable Architecture.pptx
PPTX
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
PPTX
Warsaw MuleSoft Meetup #16 DF Tour.pptx
PPTX
Warsaw MuleSoft Meetup #15 - Hyperautomation with MuleSoft - Composer 101
PPTX
Marketing Cloud integration with MuleSoft
PPTX
MuleSoft CloudHub API Versioning
PPTX
Warsaw mulesoft meetup #9 mastering integration with salesforce
PPTX
Warsaw MuleSoft Meetup #7 - custom policy
PPTX
Warsaw MuleSoft Meetup #6 - CI/CD
PPTX
Mule soft meetup warsaw november 13th, 2019
PDF
MuleSoft approach to the integration - Warsaw MuleSoft Meetup
PPTX
Warsaw MuleSoft Meetup - Runtime Fabric
PPTX
MuleSoft Meetup Warsaw Group DataWeave 2.0
PPTX
MuleSoft Meetup Warsaw Group #1
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
CI/CD Practices in MuleSoft – CloudHub 1 vs CloudHub 2
Warsaw MuleSoft Meetup - Agentforce Community Tour.pdf
Warsaw MuleSoft Meetup - Composable Architecture.pptx
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Warsaw MuleSoft Meetup #16 DF Tour.pptx
Warsaw MuleSoft Meetup #15 - Hyperautomation with MuleSoft - Composer 101
Marketing Cloud integration with MuleSoft
MuleSoft CloudHub API Versioning
Warsaw mulesoft meetup #9 mastering integration with salesforce
Warsaw MuleSoft Meetup #7 - custom policy
Warsaw MuleSoft Meetup #6 - CI/CD
Mule soft meetup warsaw november 13th, 2019
MuleSoft approach to the integration - Warsaw MuleSoft Meetup
Warsaw MuleSoft Meetup - Runtime Fabric
MuleSoft Meetup Warsaw Group DataWeave 2.0
MuleSoft Meetup Warsaw Group #1

Recently uploaded (20)

PDF
KodekX | Application Modernization Development
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Advanced Soft Computing BINUS July 2025.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Advanced IT Governance
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Modernizing your data center with Dell and AMD
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Cloud computing and distributed systems.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Empathic Computing: Creating Shared Understanding
PDF
NewMind AI Monthly Chronicles - July 2025
DOCX
The AUB Centre for AI in Media Proposal.docx
KodekX | Application Modernization Development
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Advanced methodologies resolving dimensionality complications for autism neur...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Advanced Soft Computing BINUS July 2025.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Advanced IT Governance
Understanding_Digital_Forensics_Presentation.pptx
Modernizing your data center with Dell and AMD
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
Network Security Unit 5.pdf for BCA BBA.
GamePlan Trading System Review: Professional Trader's Honest Take
Mobile App Security Testing_ A Comprehensive Guide.pdf
Cloud computing and distributed systems.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Empathic Computing: Creating Shared Understanding
NewMind AI Monthly Chronicles - July 2025
The AUB Centre for AI in Media Proposal.docx

MuleSoft JWT Demystified

  • 1. 06/10/2020 Warsaw MuleSoft Meetup Group JSON Web Token demystified
  • 2. 2 ● Introductions & Community Updates ● Introduction to JWT ● JSON Validation Policy ● Consuming service with JWT validation policy ● Quiz & Lottery ● What’s next & Close Agenda
  • 5. 5 ● Subject Matter Expert at PwC Poland ● MuleSoft Ambassador ● MuleSoft Meetup Leader for Warsaw, Poland ● Working with MuleSoft products for over 8 years now ● One of Salesforce Trailblazers https://trailhead.salesforce.com/trailblazers/patryk-bandurski Organizer / Speaker Check out my integration blog https://ambassadorpatryk.com/blog
  • 6. Share the event 6 ● Share the Meetup in your social media ● Use Hashtags #MuleSoftMeetup #WarsawMuleSoftMeetup Thanks 
  • 8. 8 MuleSoft CONNECT:Now MuleSoft CONNECT:Now is a virtual experience bringing you a full program of technical sessions and content, streamed online for free! Register for free: https://connect.mulesoft.com
  • 9. 9 Developer Meetups at CONNECT:Now events Meet the MuleSoft Community! ● Hear technical use cases from customer and partner MuleSoft experts around the globe ● Live chat with MuleSoft Ambassadors! JOIN ONLINE FOR FREE: EMEA: October 8, 2020 AMER: October 13, 2020 APAC: October 20, 2020 Register: https://connect.mulesoft.com/
  • 10. Check out the technical presentations below: Developer Meetup at CONNECT:Now EMEA ● Twitter ○ Felipe Ocadiz, MuleSoft Ambassador, IT Integration Engineer ○ How to become an Anypoint Studio ninja ● Saint-Gobain ○ Francis Edwards, MuleSoft Ambassador, Integration Analyst ○ Useful integration tools JOIN FOR FREE: October 8, 2020 (10:30am-11:15am BST) Register: https://connect.mulesoft.com/events/connect/emea
  • 11. Check out the technical presentations below: Developer Meetup at CONNECT:Now Americas ● AT&T ○ Brad Ringer, Principal System Engineer ○ MuleSoft Runtime Fabric: The road to success ● MuleSoft Ambassadress ○ Alexandra Martinez, Sr. MuleSoft Developer, Bits in Glass ○ Reviewing a complex DataWeave transformation JOIN FOR FREE: October 13, 2020 (10:30am-11:15am PDT) Register: https://connect.mulesoft.com/events/connect/amer
  • 12. Check out the technical presentations below: Developer Meetup at CONNECT:Now JAPAC ● Datacom ○ Mary Joy Sabal, Sr. Integration Developer ○ Using Maven Archetypes to create MuleSoft API Project Templates ● MuleSoft Ambassador ○ Sravan Lingam, Consultant, Virtusa ○ Create a virtual Tic-Tac-Toe game using Object Store v2 JOIN FOR FREE: October 20, 2020 (2:30pm-3:15pm AEDT) Register: https://connect.mulesoft.com/events/connect/japac
  • 13. 13 Follow Mariana Lemus on LinkedIn
  • 14. MuleSoft Ambassadors ● People to learn from ● Active in the MuleSoft Community ● Worth following ● 20 MuleSoft Ambassadors: https://developer.mules oft.com/dev/ambassado rs 14
  • 15. ● MuleSoft Partner Calendar MuleSoft Partnership ● Free online tutored Development Fundamentals available now! ● Visit Partnership Calendar https://www.mulesoft.com/integration-partner/program/calendar ● Other interesting calendars: 15
  • 17. JSON Web Token „JSON web token (JWT), pronounced "jot", is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Again, JWT is a standard, meaning that all JWTs are tokens, but not all tokens are JWTs.” Auth0 Docs https://tools.ietf.org/html/rfc7515
  • 18. JWS Structure ● JOSE Header ○ Algorithm used to sign ● Payload ○ Claims – statements about caller/user. We have registered claims, public claims and private claims. ● Signature ○ Signed encoded header and payload parts 18
  • 19. Payload part of JWS 19 Claim property Claim name Description Example iss Issuer Issuer of the JWT Me sub Subject Subject of the JWT (the user) Bob aud Audience Recipient for which the JWT is intended https://api.ambassadorpatryk.co m nbf Not Before Time before which the JWT must not be accepted for processing. Unix timestamp. 1516239022 iat Issued At Time at which the JWT was issued; can be used to determine age of the JWT. Unix timestamp. 1516239022 id Id Unique identifier; can be used to prevent the JWT from being replayed (allows a token to be used only once) b32737dc-adb0-4faf-8e38- 7d0478f18a2e exp Expiration Time identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. Unix timestamp. 1516239022
  • 20. Signature base64urlEncoded(Header) + „.” + base64urlEncoded(Payload) 20
  • 22. JWT Validation Policy ● Supports ○ RS256, RS384, RS512 (RSA) ○ HS256, HS384, HS512 (HMAC) ● Supports registered claims and custom claims ● JWT Key ○ Static private value ○ Dynamicaly retrieved from JWKS ● Read more -> https://docs.mulesoft.com/api-manager/2.x/policy-mule4-jwt-validation 22
  • 23. RSA256 with extra validation • Registered claims • Private claims (mandatory, not mandatory) DEMO Setup JWT validation policy
  • 24. [DEMO] JWT Validation Policy Configuration ● Authorization header ● RSA 256 signing algorithm ● Public key static in policy 24
  • 25. [DEMO] JWT Validation Policy Configuration ● Do not validate client id ● Validate audience (aud) ○ Expected values one of ■ pl-lb.anypointdns.com ■ Api.patrykbandurski.com ■ test.patrykbandurski.com ● Expiration (exp) is mandatory ● Apply to all methods and resources 25
  • 26. [DEMO] JWT Validation Policy Generate JWS and place it in authorization header 400 Bad Request – no authorization header 401 Unauthorized – wrong token 26
  • 27. [DEMO] JWT Validation Policy 27 [jwt-validation-1111044-sfdc-jwt-xapi-main].1111044-client-id-enforcementDEBUG event:d87e0230-064c-11eb-a171-066db5e9ec56 Token was parsed successfully. [jwt-validation-1111044-sfdc-jwt-xapi-main].1111044-client-id-enforcementDEBUG event:d87e0230-064c-11eb-a171-066db5e9ec56 Ready to validate the signature of the token. [jwt-validation-1111044-sfdc-jwt-xapi-main].1111044-client-id-enforcementDEBUG event:d87e0230-064c-11eb-a171-066db5e9ec56 Token signature successfully validated. [jwt-validation-1111044-sfdc-jwt-xapi-main].1111044-client-id-enforcementDEBUG event:d87e0230-064c-11eb-a171-066db5e9ec56 Validating aud claim. [jwt-validation-1111044-sfdc-jwt-xapi-main].1111044-client-id-enforcementDEBUG event:d87e0230-064c-11eb-a171-066db5e9ec56 The server did not identify with the any of the audiences '[aapi.patrykbandurski.com].' DEBUG com.mulesoft.extension.policies.jwt on logging
  • 28. [DEMO] JWT Validation Policy 28 ● jwt.io ● Generate token ● Aud, iat, exp ● Public & private key ● Remember! Do not use online tools to generate
  • 29. [DEMO] JWT Validation Policy 29 ● Required and optional private claims ● Static comparison ● Complex expression with DataWeave Required claim email is not present in the JWT. Token will be rejected.
  • 30. [DEMO] JWT Validation Policy 30 ● Non mandatory claims. ○ Validate when claim name prasent ○ Can be complex – DataWeave – example roles is an Array haveing at least one item. Available values are USER, ADMIN or CONTRIBUTOR ○ Refer to claim via vars.claimSet.[claim- name] In case of failed condition, this will be saved in the log file "Condition ... not met"
  • 31. JWKS (JSON Web Keys Set) ● Set of keys contains the public keys used to verify any JWT ● JWK (JSON Web Key) – JSON object representing a cryptographic key ● Rotation of the keys at ease ● Key retrieved dynamically 31
  • 32. JWK { "kty": "RSA", "e": "AQAB", "alg": "RS256", "kid": "uniqueid", "n": "lgyuFifEOODgA4rZP2gQUunm_nM4G5a9aHoLkEosrMPuD4 LClPbke9nn0LUJ4H-M_3rX9- yXhjzhjrduUDcImVMBATN7UsYOxYOZvqUjRf72y1eNjIWMnLBCWB uQZrhqN73ttCOJLg28llI- 65XDfd6qeOlSlGWQD1YSGjX8cHDXoADXOpKrwPZy1ghkJMMtsvFx QNJd8hVvmzPlq-jefOXFOcsBjCB- QQkA3Lty0dScKPKfFQVooZxVhqU_r2wrSvviAdl8pN5yKmhcmT9S 9Ke-mfpJXOnYB9y3Z9xRb0RFQBhrDBLNEc1TDCeRX2RZ- A9pUJ0IbG-b-rFlQYjNOw" } 32
  • 33. Working with JWKS ● Provide url to JWKS – publicly available ● 503 Service Unavailable– JWKS is not accessible ● 401 Unauthorized – signing error 33
  • 34. RSA256 using JSON Web Keys Set DEMO Setup JWT validation policy
  • 35. [DEMO] JWT Validation Policy - JWKS ● JWKS service ● Standard which allows customer to rated public keys 35
  • 36. [DEMO] JWT Validation Policy - JWKS ● URL to JWKS 36
  • 37. [DEMO] JWT Validation Policy - JWKS { "keys": [ { "kty": "RSA", "e": "AQAB", "alg": "RS256", "kid": "uniqueid", "n": "…" } ] } 37 JSON Web Keys Set:
  • 38. Consume 3rd party service with JWT Validation Policy
  • 39. Generating JWS in Mule ● No native support in MuleSoft ● Salesforce OAuth JWT authentication mechanism ● Custom code: ○ JAVA ■ JJWT library https://github.com/jwtk/jjwt ○ Ruby ■ ruby-jwt library https://github.com/jwt/ruby-jwt ● Mule Custom Component: ○ JWT Component Extension https://github.com/dyeeye/jwt-component
  • 40. JJWT sample code JwtBuilder builder = Jwts.builder() // (1) .setIssuer(claims.getIssuer()) // (2) .setSubject(claims.getSubject()) .setAudience(claims.getAudience()) .setNotBefore(claims.getNotBefore()) .setIssuedAt(claims.getIssuedAt()) .setId(claims.getId()); String jws = builder .signWith(privKey, SignatureAlgorithm.valueOf(algorithm)) // (3) .compact(); // (4) 40
  • 41. JWT Component ● Supports signing algorithms ○ RSA 256, 384 and 512 ○ HMAC 256, 384 and 512 ● Claims ○ Registered ○ Private ● Visual support in Anypoint Studio ● Reads keystore from classpath 41
  • 42. Service secured with JWT Validation Policy RSA DEMO Consume service
  • 44. [DEMO] Generating JWT ● Removed expected expiration claim ● 401 in return 44
  • 46. Quiz
  • 47. Trivia Quiz ● Quiz parts: ○ Three warm-up questions (you won’t get point from them) ○ Five questions (for points) ● Remember! ○ The quicker you respond more point you earn ○ Only good answers count  47 Three winners of today’s quiz receives: Free voucher for MuleSoft online training and exam
  • 48. Lottery ● How it works? ○ I call API that selects randomly three winners among checked-in attendees. ○ I will ask winners by Name & Surname for the email ● Remember! ○ Prize is sponsored by 48 Three winners of today’s lottery receives: Amazon Voucher for 50$
  • 49. Congratulation ● Congratulation to all the winners ○ of the Quiz ○ of the lottery ● Remember to send your email address to the organizer via chat window! 49
  • 51. Share your knowledge ● Become a speaker and share your knowledge with our community ● Submit your idea via this form: https://tinyurl.com/become-speaker via email patryk.bandurski@gmail.com or 51
  • 52. 52 ● Share: ○ Tweet using the hashtag #MuleSoftMeetups ○ Invite your network to join: https://meetups.mulesoft.com/warsaw/ ● Feedback: ○ Fill out the survey feedback and suggest topics for upcoming events ○ Contact MuleSoft at meetups@mulesoft.com for ways to improve the program What’s next?
  • 53. See you next time