Client Credentials Flow ┌────────────┐ ┌──────┐ │nginx + │ ┌───────────┐ ┌──────────────┐ ┌────────────────┐ │Client│ │auth_request│ │vouch-proxy│ │OAuth-provider│ │Service-provider│ └───┬──┘ └──────┬─────┘ └─────┬─────┘ └───────┬──────┘ └────────┬───────┘ ╔══════╧═══════╗ │ ╔═════════════╧═════════════╗ │ │ ║Needs: ░║ │ ║Configuration includes: ░║ │ │ ║clientId ║ │ ║OAuth-provider URL /token ║ │ │ ║clientSecret ║ │ ╚═════════════╤═════════════╝ │ │ ║scopes ║ │ │ │ │ ╚══════╤═══════╝ │ │ │ │ │ │ │ │ │ ╔══════╤══════╪════════════════════════════════════════════════════════╪════════════════════════════════════════════════════════╪════════════════════════════════════════════════════════╪═══════════════════════════╪══════════════════╗ ║ ALT │ first access / token expired │ │ │ │ ║ ╟──────┘ │ │ │ │ │ ║ ║ │ GET /Addressbook │ │ │ │ ║ ║ │───────────────────────────────────────────────────────>│ │ │ │ ║ ║ │ │ │ │ │ ║ ║ │ │ GET /validate │ │ │ ║ ║ │ │───────────────────────────────────────────────────────>│ │ │ ║ ║ │ │ │ │ │ ║ ║ │ │ 401 Unauthorized │ │ │ ║ ║ │ │<───────────────────────────────────────────────────────│ │ │ ║ ║ │ │ │ │ │ ║ ║ │ 302 /auth url=/Addressbook │ │ │ │ ║ ║ │<───────────────────────────────────────────────────────│ │ │ │ ║ ║ │ │ │ │ │ ║ ║ │GET /auth url=/Addressbook │ │ │ │ ║ ║ │+ clientId + clientSecret + scopes │ │ │ │ ║ ║ │───────────────────────────────────────────────────────>│ │ │ │ ║ ║ │ │ │ │ │ ║ ║ │ │GET /auth url=/Addressbook │ │ │ ║ ║ │ │+ clientId + clientSecret + scopes │ │ │ ║ ║ │ │───────────────────────────────────────────────────────>│ │ │ ║ ║ │ │ │ │ │ ║ ║ │ │ ╔═══════╧═══════╗ │ │ ║ ║ │ │ ║Save redirect ░║ │ │ ║ ║ │ │ ╚═══════╤═══════╝ │ │ ║ ║ │ │ │GET /token │ │ ║ ║ │ │ │+ clientId + clientSecret + scopes │ │ ║ ║ │ │ │───────────────────────────────────────────────────────>│ │ ║ ║ │ │ │ │ │ ║ ║ │ │ │ 200 token │ │ ║ ║ │ │ │<───────────────────────────────────────────────────────│ │ ║ ║ │ │ │ │ │ ║ ║ │ │ ╔═══════════╧═══════════╗ │ │ ║ ║ │ │ ║Return saved redirect ░║ │ │ ║ ║ │ │ ╚═══════════╤═══════════╝ │ │ ║ ║ │ │ 302 /Addressbook │ │ │ ║ ║ │ │ VouchCookie │ │ │ ║ ║ │ │<───────────────────────────────────────────────────────│ │ │ ║ ║ │ │ │ │ │ ║ ║ │ 302 /Addressbook │ │ │ │ ║ ║ │ VouchCookie │ │ │ │ ║ ║ │<───────────────────────────────────────────────────────│ │ │ │ ║ ╠═════════════╪════════════════════════════════════════════════════════╪════════════════════════════════════════════════════════╪════════════════════════════════════════════════════════╪═══════════════════════════╪══════════════════╣ ║ [all subsequent accesses] │ │ │ │ ║ ║ │ GET /Addressbook │ │ │ │ ║ ║ │ VouchCookie │ │ │ │ ║ ║ │───────────────────────────────────────────────────────>│ │ │ │ ║ ║ │ │ │ │ │ ║ ║ │ │ GET /validate │ │ │ ║ ║ │ │ VouchCookie │ │ │ ║ ║ │ │───────────────────────────────────────────────────────>│ │ │ ║ ║ │ │ │ │ │ ║ ║ │ │ 200 │ │ │ ║ ║ │ │<───────────────────────────────────────────────────────│ │ │ ║ ║ │ │ │ │ │ ║ ║ │ │ GET /Addressbook │ │ ║ ║ │ │ VouchCookie │ │ ║ ║ │ │────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ ║ ║ │ │ │ │ │ ║ ║ │ │ │ 200 data │ │ ║ ║ │ │<────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│ ║ ║ │ │ │ │ │ ║ ║ │ 200 data │ │ │ │ ║ ║ │<───────────────────────────────────────────────────────│ │ │ │ ║ ╚═════════════╪════════════════════════════════════════════════════════╪════════════════════════════════════════════════════════╪════════════════════════════════════════════════════════╪═══════════════════════════╪══════════════════╝ ┌───┴──┐ ┌──────┴─────┐ ┌─────┴─────┐ ┌───────┴──────┐ ┌────────┴───────┐ │Client│ │nginx + │ │vouch-proxy│ │OAuth-provider│ │Service-provider│ └──────┘ │auth_request│ └───────────┘ └──────────────┘ └────────────────┘ └────────────┘