Authentication, Authorization, and Secret Management

Authentication establishes who or what is making a request; authorization determines which actions are permitted. Use least privilege and enforce authorization server-side for every object and operation. Hiding a button in the UI is not access control.

Sessions and tokens have different revocation and storage trade-offs. Short-lived access tokens limit exposure but require refresh and rotation strategies. Cookies need appropriate Secure, HttpOnly, and SameSite settings for the deployment context, and CSRF protections where relevant. JWT signatures do not encrypt claims unless an encryption format is used.

Store secrets in a managed secret store, restrict access, rotate credentials, and avoid placing secrets in source code, client bundles, logs, or error messages. Service-to-service authentication should use workload identity or scoped credentials where practical, not a shared permanent secret distributed to every component.

Key Takeaways
  • Authentication and authorization are separate checks.
  • A signed JWT is not automatically confidential.
  • Secrets need least-privilege access, rotation, and leak-safe logging.