Authentication and tokensintermediate
A JWT is a signed note saying who the caller is; issuing one, refreshing it before it expires, and never storing a password in plain text are the three things every API has to get right.
Change the id in the URL and you can read another customer’s balance. The credit endpoint does not need a token at all. Close both, and answer with the status code that tells the client the truth.
AssumesAuth APIIssuing the token and checking a role come first. This stage is about what the token does not tell you: whose wallet it is.
Claims read as issued, policy checks role and scope, owner-or-admin enforced in the action with Forbid(), and no public write.
Published in full, before you start — every point is one of these and there is nothing else.
A JWT is a signed note saying who the caller is; issuing one, refreshing it before it expires, and never storing a password in plain text are the three things every API has to get right.
Authentication is who you are; authorization is what you are allowed to do. Policies keep that rule in one place instead of scattered if-statements.