| 1 | <!doctype html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="utf-8" /> |
| 5 | <meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
| 6 | <title>Mermaid Zenuml Test Page</title> |
| 7 | </head> |
| 8 | |
| 9 | <body> |
| 10 | <h1>Zenuml demos</h1> |
| 11 | <pre class="mermaid"> |
| 12 | zenuml |
| 13 | BookLibService.Borrow(id) { |
| 14 | User = Session.GetUser() |
| 15 | if(User.isActive) { |
| 16 | try { |
| 17 | BookRepository.Update(id, onLoan, User) |
| 18 | receipt = new Receipt(id, dueDate) |
| 19 | } catch (BookNotFoundException) { |
| 20 | ErrorService.onException(BookNotFoundException) |
| 21 | } finally { |
| 22 | Connection.close() |
| 23 | } |
| 24 | } |
| 25 | return receipt |
| 26 | } |
| 27 | </pre> |
| 28 | <pre class="mermaid"> |
| 29 | zenuml |
| 30 | title Async Messages (SPA Authentication) |
| 31 | // ``` |
| 32 | // GET https://${account.namespace}/authorize/? |
| 33 | // response_type=token |
| 34 | // &client_id=${account.clientId} |
| 35 | // &redirect_url=YOUR_CALLBACK_URL |
| 36 | // &state=VALUE_THAT_SURVIVES_REDIRECTS |
| 37 | // &scope=openid |
| 38 | // ``` |
| 39 | Browser->Auth0: 1. initiate the authentication |
| 40 | Auth0->"Identity Provider": 2. OAuth2 / SAML, etc |
| 41 | "Identity Provider"->"Identity Provider": 3. user gets authenticated |
| 42 | Auth0->Browser: 4. redirect to ${YOUR_CALLBACK_URL}/#id_token=e68... |
| 43 | Browser->Auth0: 5. validate id_token and get user profile |
| 44 | Browser->"Your API": 6. call API sending JWT in Authorization header |
| 45 | "Your API"->"Your API": 7. validate token |
| 46 | </pre> |
| 47 | |
| 48 | <script type="module"> |
| 49 | import mermaid from './mermaid.esm.mjs'; |
| 50 | import zenuml from './mermaid-zenuml.esm.mjs'; |
| 51 | await mermaid.registerExternalDiagrams([zenuml]); |
| 52 | mermaid.initialize({ |
| 53 | logLevel: 3, |
| 54 | }); |
| 55 | </script> |
| 56 | </body> |
| 57 | </html> |
| 58 | |