KEMBAR78
JSON Web Token | PDF
JSONWEBTOKEN
DeddySetyadi
Itshipsinformation
thatcanbeverified
andtrusted
withadigitalsignature
JWT?
http://searchsecurity.techtarget.com/definition/digital-signature
Stateless
JWTallowtheservertoverifythe
informationcontainedintheJWT
withoutnecessarilystoringstate
ontheserver.
http://secure.indas.on.ca
http://www.slideshare.net/liuggio/json-web-token-api-authorizatio
n
NONEEDPROTECTAGAINSTCSRF
https://www.incapsula.com/web-application-security/csrf-cross-site-request-forgery.html
AVOIDMan-in-the-middle
https://blog.digicert.com/thwarting-man-middle/
JSONWEBTOKEN
https://scotch.io/tutorials/the-anatomy-of-a-json-web-token
Header
{
"typ": "JWT",
"alg": "HS256"
}
PARTSOFTheheader:
● declaringthetype,which
isJWT
● thehashingalgorithmto
use
CommonJWTSigningAlgorithms
HS256 HMAC using SHA-256
RS256 RSASSA-PKCS1-v1_5 using SHA-256
ES256 ECDSA using P-256 and SHA-256
https://tools.ietf.org/html/rfc7518#section-3
Payload
Carrytheinformationthatwe
wanttotransmit,alsocalled
theJWTClaims.
{
"iss": "scotch.io",
"exp": 1300819380,
"name": "Chris Sevilleja",
"admin": true
}
ReSERVEDClaims
iss
Theissuerofthetoken.
sub
Thesubjectofthetoken.
aud
Theaudienceofthetoken.
exp
Thiswilldefinetheexpiration.
nbf
thetimebeforewhichtheJWTMUST
NOTbeaccepted.
iat
ThetimetheJWTwasissued.
jti
UniqueidentifierfortheJWT.
https://tools.ietf.org/html/rfc7518#section-3
Signature
Madeupofahashofthe
followingcomponents:
● theheader
● thepayload
● secret
var encodedString =
base64UrlEncode(header) + "." +
base64UrlEncode(payload);
HMACSHA256(encodedString,'secret');
FullJSONofJWT
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
eyJpc3MiOiJzY290Y2guaW8iLCJleHAiOjEz
MDA4MTkzODAsIm5hbWUiOiJDaHJpcyB
TZXZpbGxlamEiLCJhZG1pbiI6dHJ1ZX0.
03f329983b86f7d9a9f5fef85305880101d5e302
afafa20154d094b229f757
HEADER
CLAIMS
SIGNATURE
References
● http://www.slideshare.net/liuggio/json-web-token-api-a
uthorization
● https://scotch.io/tutorials/the-anatomy-of-a-json-web-t
oken
● https://auth0.com/blog/json-web-token-signing-algorit
hms-overview/
● http://jwt.io
● https://blog.digicert.com/thwarting-man-middle/
● https://www.incapsula.com/web-application-security/cs
rf-cross-site-request-forgery.html

JSON Web Token