┌─┐ ║"│ └┬┘ ┌┼┐ │ ┌──────┐ ┌──┐ ┌───────┐ ┌────────┐ ┌───┐ ┌┴┐ │Client│ │OS│ │Browser│ │ownCloud│ │IDP│ Alice └───┬──┘ └─┬┘ └───┬───┘ └────┬───┘ └─┬─┘ │ login │ │ │ │ │ │────────────────>│ │ │ │ │ │ │ │ │ │ │ │ │ │ GET https://.../status.php │ │ │ │──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ │ │ │ │ 200 OK │ │ │ │<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ │ │ │ │ │ │ │ │ │ PROPFIND https://.../webdav │ │ │ │──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ │ │ │ 401 Unauthorized with Response Header "WWW-Authenticate: Bearer realm="ownCloud"" (and other WWW-Authenticate mechanisms, if available) │ │ │ │<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╔══════╤═════╪═════════════════╪═══════════════════════════════════════╪════════════════════════════════════╪══════════════════════════════════════════════════════════════════════════════╪═════════════════╪═══════════╗ ║ ALT │ Bearer auth available│ │ │ │ │ ║ ╟──────┘ │ │ │ │ │ │ ║ ║ │ │────┐ │ │ │ │ ║ ║ │ │ │ listen on http://localhost:61113 │ │ │ │ ║ ║ │ │<───┘ │ │ │ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ open in browser │ │ │ │ ║ ║ │ │ https://.../apps/oauth2/authorize? │ │ │ │ ║ ║ │ │ response_type=code& │ │ │ │ ║ ║ │ │ client_id=& │ │ │ │ ║ ║ │ │ redirect_uri=http://localhost:61113 │ │ │ │ ║ ║ │ │──────────────────────────────────────>│ │ │ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │open │ │ │ ║ ║ │ │ │https://.../apps/oauth2/authorize? │ │ │ ║ ║ │ │ │response_type=code& │ │ │ ║ ║ │ │ │client_id=& │ │ │ ║ ║ │ │ │redirect_uri=http://localhost:61113 │ │ │ ║ ║ │ │ │───────────────────────────────────>│ │ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │ GET │ │ ║ ║ │ │ │ │ https://.../apps/oauth2/authorize? │ │ ║ ║ │ │ │ │ response_type=code& │ │ ║ ║ │ │ │ │ client_id=& │ │ ║ ║ │ │ │ │ redirect_uri=http://localhost:61113 │ │ ║ ║ │ │ │ │─────────────────────────────────────────────────────────────────────────────>│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │ Redirect to Login │ │ ║ ║ │ │ │ │<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │ GET │ │ ║ ║ │ │ │ │ https://.../login │ │ ║ ║ │ │ │ │─────────────────────────────────────────────────────────────────────────────>│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │ Redirect to IDP │ │ ║ ║ │ │ │ │<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │ GET │ │ ║ ║ │ │ │ │ https://idp.tld/... │ │ ║ ║ │ │ │ │───────────────────────────────────────────────────────────────────────────────────────────────>│ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │ Redirect back to ownCloud │ │ ║ ║ │ │ │ │<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │ GET │ │ ║ ║ │ │ │ │ https://.../login │ │ ║ ║ │ │ │ │─────────────────────────────────────────────────────────────────────────────>│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │ Redirect to original Authorize URL │ │ ║ ║ │ │ │ │<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │ GET │ │ ║ ║ │ │ │ │ https://.../apps/oauth2/authorize? │ │ ║ ║ │ │ │ │ response_type=code& │ │ ║ ║ │ │ │ │ client_id=& │ │ ║ ║ │ │ │ │ redirect_uri=http://localhost:61113 │ │ ║ ║ │ │ │ │─────────────────────────────────────────────────────────────────────────────>│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │The “Desktop Client“ application would like permission to access your account │ │ ║ ║ │ │ │ │<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ click “Authorize“ │ │ │ │ ║ ║ │─────────────────────────────────────────────────────────────────────────────────────────────>│ │ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │ POST │ │ ║ ║ │ │ │ │ https://.../apps/oauth2/authorize? │ │ ║ ║ │ │ │ │ response_type=code& │ │ ║ ║ │ │ │ │ client_id=&redirect_uri=http://localhost:61113 │ │ ║ ║ │ │ │ │─────────────────────────────────────────────────────────────────────────────>│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │ Redirect http://localhost:61113? │ │ ║ ║ │ │ │ │ code=b8jQreTvhv... │ │ ║ ║ │ │ │ │<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ GET http://localhost:61113? │ │ │ ║ ║ │ │ code=b8jQreTvhv... │ │ │ ║ ║ │ │<───────────────────────────────────────────────────────────────────────────│ │ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ POST │ │ │ ║ ║ │ │ │ https://.../apps/oauth2/api/v1/token │ │ ║ ║ │ │──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ 200 OK - {"access_token":"UyP6InfhUe... │ │ ║ ║ │ │<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ Redirect to https://.../apps/oauth2/authorization-successful │ │ │ ║ ║ │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ >│ │ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │ GET │ │ ║ ║ │ │ │ │ https://.../apps/oauth2/authorization-successful │ │ ║ ║ │ │ │ │─────────────────────────────────────────────────────────────────────────────>│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ │ 200 OK │ │ ║ ║ │ │ │ │<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ PROPFIND https://.../webdav/ │ │ ║ ║ │ │ │ Authorization: Bearer UyP6InfhUed58Gy.... │ │ ║ ║ │ │──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ 207 Multi-Status │ │ ║ ║ │ │<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ ║ ╠════════════╪═════════════════╪═══════════════════════════════════════╪════════════════════════════════════╪══════════════════════════════════════════════════════════════════════════════╪═════════════════╪═══════════╣ ║ [fall back to Basic auth (or another auth mechanism)] │ │ │ │ ║ ║ │ │ │ PROPFIND https://.../webdav/ │ │ ║ ║ │ │ │ Authorization: Basic .... │ │ ║ ║ │ │──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ │ ║ ║ │ │ │ │ │ │ ║ ║ │ │ │ 207 Multi-Status │ │ ║ ║ │ │<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ ║ ╚════════════╪═════════════════╪═══════════════════════════════════════╪════════════════════════════════════╪══════════════════════════════════════════════════════════════════════════════╪═════════════════╪═══════════╝ Alice ┌───┴──┐ ┌─┴┐ ┌───┴───┐ ┌────┴───┐ ┌─┴─┐ ┌─┐ │Client│ │OS│ │Browser│ │ownCloud│ │IDP│ ║"│ └──────┘ └──┘ └───────┘ └────────┘ └───┘ └┬┘ ┌┼┐ │ ┌┴┐