Pcornel
Networking · Security › REST API Security

REST API Authentication

Cheat sheet · https://pcornel.dk/topic.php?topic=1548

Back to the Topic

Answer

Authentication establishes the principal making an API request; it does not decide every operation the principal may perform.

Remember

A successful login is not a least-privilege or full-service test.

First checks

curl -i https://host/api/… without credentials → expect 401. Repeat with the Authorization header → 200. Check that credentials are not placed in the URL and do not appear in logs or shell history.

Verify in this order

TLS established → credential sent in the Authorization header (token, key) or as a client certificate → server validates it → 401 when missing or invalid → identity attached to the request → authorization decides next

Where it usually breaks

physical/link dependency → local object state → peer/control state → policy → forwarding/adjacency → end-to-end result

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=1548

Confirmation

Confirm action

Continue?