jwts in java for csrf and microservices

14

Upload: stormpath

Post on 13-Jan-2017

237 views

Category:

Technology


6 download

TRANSCRIPT

Page 1: JWTs in Java for CSRF and Microservices
Page 2: JWTs in Java for CSRF and Microservices

••••

Page 3: JWTs in Java for CSRF and Microservices

Page 4: JWTs in Java for CSRF and Microservices

User Data

User Workflows Google ID

Your ApplicationsApplication SDK

Application SDK

Application SDK

ID Integrations

Facebook

Active Directory

SAML

Page 5: JWTs in Java for CSRF and Microservices
Page 6: JWTs in Java for CSRF and Microservices

encodeSecret =

"4pE8z3PBoHjnV1AhvGk+e8h2p+ShZpOnpr8cwHmMh1w="

computeHMACSHA256(

header + "." + payload,

base64DecodeToByteArray(encodedSecret)

)

Signature Computation Pseudo-code

Page 7: JWTs in Java for CSRF and Microservices
Page 8: JWTs in Java for CSRF and Microservices

.signWith( SignatureAlgorithm.HS256, "secret".getBytes("UTF-8") )

Short but not Sweet

Page 9: JWTs in Java for CSRF and Microservices

String b64EncodedSecret =

"Yn2kjibddFAWtnPJ2AFlL8WXmohJMCvigQggaEypa5E=";

.signWith(

SignatureAlgorithm.HS256,

b64EncodedSecret.getBytes("UTF-8")

)

You’re Doing it Wrong

Page 10: JWTs in Java for CSRF and Microservices

String b64EncodedSecret =

"Yn2kjibddFAWtnPJ2AFlL8WXmohJMCvigQggaEypa5E=";

.signWith(

SignatureAlgorithm.HS512,

TextCodec.BASE64.decode(b64EncodedSecret)

)

Supersize that Secret!

Page 11: JWTs in Java for CSRF and Microservices
Page 12: JWTs in Java for CSRF and Microservices

AuthenticationServiceAuthorizationServiceApplicationService

OrganizationServiceDirectoryServiceAccountServiceGroupService

DatabaseInfrastructure

Page 13: JWTs in Java for CSRF and Microservices

DatabaseInfrastructure

GroupServiceAccountService

AuthenticationService AuthorizationService

ApplicationService OrganizationService DirectoryService

Page 14: JWTs in Java for CSRF and Microservices

●○○

●●●●●●

○●