chartletv0.21.0chartlet.casoon.de

← All examples

Sign-in with OIDC and a backend for frontend

A browser, a backend for frontend, an identity provider, an API and a database: fifteen numbered messages through an OIDC sign-in, a self-call that creates the session, and an opt fragment around the asynchronous back-channel logout. The description lists the messages in order and names the fragment with the messages it spans. Illustrative reference architecture, with a phone variant.

Sign-in with OIDC and a backend for frontend

examples/sign-in-sequence.json
{
  "schemaVersion": 1,
  "type": "sequence",
  "title": "Sign-in with OIDC and a backend for frontend",
  "source": "Illustrative reference architecture",
  "width": 900,
  "height": 900,
  "sequence": {
    "participants": [
      {
        "id": "browser",
        "label": "Browser",
        "kind": "actor"
      },
      {
        "id": "bff",
        "label": "Web / BFF",
        "sublabel": "SvelteKit"
      },
      {
        "id": "idp",
        "label": "Keycloak",
        "sublabel": "OIDC"
      },
      {
        "id": "api",
        "label": "Domain API",
        "sublabel": "Rust"
      },
      {
        "id": "db",
        "label": "Postgres",
        "sublabel": "RLS",
        "kind": "database"
      }
    ],
    "messages": [
      {
        "from": "browser",
        "to": "bff",
        "label": "GET /grades"
      },
      {
        "from": "bff",
        "to": "browser",
        "label": "Redirect, PKCE",
        "kind": "reply"
      },
      {
        "from": "browser",
        "to": "idp",
        "label": "Sign in, 2FA"
      },
      {
        "from": "idp",
        "to": "browser",
        "label": "Code",
        "kind": "reply"
      },
      {
        "from": "browser",
        "to": "bff",
        "label": "Callback with code"
      },
      {
        "from": "bff",
        "to": "idp",
        "label": "Exchange code"
      },
      {
        "from": "idp",
        "to": "bff",
        "label": "Tokens",
        "kind": "reply"
      },
      {
        "from": "bff",
        "to": "bff",
        "label": "Create session"
      },
      {
        "from": "bff",
        "to": "api",
        "label": "Load grades"
      },
      {
        "from": "api",
        "to": "db",
        "label": "Set tenant, SELECT"
      },
      {
        "from": "db",
        "to": "api",
        "label": "own school only",
        "kind": "reply"
      },
      {
        "from": "api",
        "to": "bff",
        "label": "Grades",
        "kind": "reply"
      },
      {
        "from": "bff",
        "to": "browser",
        "label": "Page, session cookie",
        "kind": "reply"
      },
      {
        "from": "idp",
        "to": "bff",
        "label": "Backchannel logout",
        "kind": "async"
      },
      {
        "from": "bff",
        "to": "bff",
        "label": "End sessions"
      }
    ],
    "fragments": [
      {
        "kind": "opt",
        "label": "central sign-out",
        "from": 13,
        "to": 14
      }
    ],
    "numbered": true
  },
  "mobile": {
    "width": 400,
    "height": 920
  }
}
Focus
Sign-in with OIDC and a backend for frontend
Sign-in with OIDC and a backend for frontendSequence diagram with 5 participants: Browser (actor), Web / BFF, Keycloak, Domain API and Postgres (database). 15 messages, in order: 1. Browser to Web / BFF: GET /grades. 2. Web / BFF to Browser: Redirect, PKCE (reply). 3. Browser to Keycloak: Sign in, 2FA. 4. Keycloak to Browser: Code (reply). 5. Browser to Web / BFF: Callback with code. 6. Web / BFF to Keycloak: Exchange code. 7. Keycloak to Web / BFF: Tokens (reply). 8. Web / BFF to itself: Create session. 9. Web / BFF to Domain API: Load grades. 10. Domain API to Postgres: Set tenant, SELECT. 11. Postgres to Domain API: own school only (reply). 12. Domain API to Web / BFF: Grades (reply). 13. Web / BFF to Browser: Page, session cookie (reply). 14. Keycloak to Web / BFF: Backchannel logout (asynchronous). 15. Web / BFF to itself: End sessions. Fragment opt "central sign-out" spans messages 14–15.opt[central sign-out]1. Browser → Web / BFF: GET /gradesGET /grades12. Web / BFF → Browser: Redirect, PKCERedirect, PKCE23. Browser → Keycloak: Sign in, 2FASign in, 2FA34. Keycloak → Browser: CodeCode45. Browser → Web / BFF: Callback with codeCallback with code56. Web / BFF → Keycloak: Exchange codeExchange code67. Keycloak → Web / BFF: TokensTokens78. Web / BFF → Web / BFF: Create sessionCreate session89. Web / BFF → Domain API: Load gradesLoad grades910. Domain API → Postgres: Set tenant, SELECTSet tenant, SELECT1011. Postgres → Domain API: own school onlyown school only1112. Domain API → Web / BFF: GradesGrades1213. Web / BFF → Browser: Page, session cookiePage, session cookie1314. Keycloak → Web / BFF: Backchannel logoutBackchannel logout1415. Web / BFF → Web / BFF: End sessionsEnd sessions15BrowserBrowserWeb / BFF – SvelteKitWeb / BFFSvelteKitKeycloak – OIDCKeycloakOIDCDomain API – RustDomain APIRustPostgres – RLSPostgresRLS
Sign-in with OIDC and a backend for frontendSequence diagram with 5 participants: Browser (actor), Web / BFF, Keycloak, Domain API and Postgres (database). 15 messages, in order: 1. Browser to Web / BFF: GET /grades. 2. Web / BFF to Browser: Redirect, PKCE (reply). 3. Browser to Keycloak: Sign in, 2FA. 4. Keycloak to Browser: Code (reply). 5. Browser to Web / BFF: Callback with code. 6. Web / BFF to Keycloak: Exchange code. 7. Keycloak to Web / BFF: Tokens (reply). 8. Web / BFF to itself: Create session. 9. Web / BFF to Domain API: Load grades. 10. Domain API to Postgres: Set tenant, SELECT. 11. Postgres to Domain API: own school only (reply). 12. Domain API to Web / BFF: Grades (reply). 13. Web / BFF to Browser: Page, session cookie (reply). 14. Keycloak to Web / BFF: Backchannel logout (asynchronous). 15. Web / BFF to itself: End sessions. Fragment opt "central sign-out" spans messages 14–15.opt[central sign-out]1. Browser → Web / BFF: GET /gradesGET /grades12. Web / BFF → Browser: Redirect, PKCERedirect, PKCE23. Browser → Keycloak: Sign in, 2FASign in, 2FA34. Keycloak → Browser: CodeCode45. Browser → Web / BFF: Callback with codeCallback with code56. Web / BFF → Keycloak: Exchange codeExchange code67. Keycloak → Web / BFF: TokensTokens78. Web / BFF → Web / BFF: Create sessionCreate session89. Web / BFF → Domain API: Load gradesLoad grades910. Domain API → Postgres: Set tenant, SELECTSet tenant, SELECT1011. Postgres → Domain API: own school onlyown school only1112. Domain API → Web / BFF: GradesGrades1213. Web / BFF → Browser: Page, session cookiePage, session cookie1314. Keycloak → Web / BFF: Backchannel logoutBackchannel logout1415. Web / BFF → Web / BFF: End sessionsEnd sessions15BrowserBrowserWeb / BFF – SvelteKitWeb /BFFSvelteKitKeycloak – OIDCKeycloakOIDCDomain API – RustDomainAPIRustPostgres – RLSPostgresRLS

Source: Illustrative reference architecture

Show chart data
Data for Sign-in with OIDC and a backend for frontend
No.FromToMessageKindFragment
1BrowserWeb / BFFGET /gradescall
2Web / BFFBrowserRedirect, PKCEreply
3BrowserKeycloakSign in, 2FAcall
4KeycloakBrowserCodereply
5BrowserWeb / BFFCallback with codecall
6Web / BFFKeycloakExchange codecall
7KeycloakWeb / BFFTokensreply
8Web / BFFWeb / BFFCreate sessioncall
9Web / BFFDomain APILoad gradescall
10Domain APIPostgresSet tenant, SELECTcall
11PostgresDomain APIown school onlyreply
12Domain APIWeb / BFFGradesreply
13Web / BFFBrowserPage, session cookiereply
14KeycloakWeb / BFFBackchannel logoutasynchronousopt [central sign-out]
15Web / BFFWeb / BFFEnd sessionscallopt [central sign-out]
  • Sequence diagram with a fragment and a phone variant
  • Explain a sign-in across services