News for hackers. Stuff that matters.
Re:JSON Web Tokens should be avoided by tofflos on Tuesday March 14, 2017 @05:29PM (#13871639)
If you're on Java and using an ORM like Hibernate, then that user will be found in the second-level cache. This will eliminate the need for a database roundtrip for all requests after the first authentication. From that point on that particular user will be retrieved from memory.
Re:JSON Web Tokens should be avoided by tracker1 on Tuesday March 14, 2017 @05:51PM (#13871795)
Which will require session pinning for the load balancer, not to mention, I'm not using Java or a similar ORM. That will only help for a single instance of an application on a single server... not much help when you specifically don't want session pinning.
Re:JSON Web Tokens should be avoided by tofflos on Tuesday March 14, 2017 @06:36PM (#13872130)
I agree that not everyone is on Java and using an ORM. But is it only useful for a single server? If you have multiple servers then you would also have a distributed second level cache which would eliminate the need for session pinning.
Re:JSON Web Tokens should be avoided by tracker1 on Tuesday March 14, 2017 @07:02PM (#13872336)
distributed, or duplicated... each server potentially making that DB request... depending on load adding at least 2-3ms, potentially more. If a given request to a single endpoint needs to touch a dozen more, not including resource lookups and when not everything is parallel... or across datacenters, from the colocated to aws, etc.. it all adds up.

Very short lived JWT mitigates this as the window for replay is reduced, over HTTPS by the time you can crack it, that window is effectively gone. The server can verify a signature on a JWT in a fraction of a second... far faster than a DB call... Not including replication issues.