• 0 Posts
  • 18 Comments
Joined 3 years ago
cake
Cake day: June 12th, 2023

help-circle





  • Here’s a simple approach:

    • Basic auth via a custom header, like X-Auth
    • JWT auth on Authorization header
    • uuid on the JWT (as a claim) that gets stored temporarily (until it expires) to allow the server to revoke the token

    Initial request -> server looks for Authorization header, falls back to X-Auth header -> generates JWT and sends back to client in Authorization header (or whatever makes sense)

    Subsequent request -> server looks for Authorization header -> checks JWT against revocation database/table and that it isn’t expired

    Subsequent request with expired token -> server returns 401, client retries using X-Auth header -> server sends back JWT on Authorization header -> client updates locally-stored JWT for future requests

    There are probably ways to make this more standard or optimal, but this is a simple approach.













  • I’ve worked in both android and spring boot and rewriting your security to use a filter chain is nothing* compared to the shenanigans google likes to pull. Keeping up with the deprecations and imaginary “best practices” is half the job. It’s like someone combined the worst parts of react with the worst Java timeline and forced people to write inscutable spaghetti that’s completely impractical/impossible to test.

    *there are valid criticisms of spring security, but I think this particular change improved things, even if it felt pointless