Wiki source code of Backend API
Last modified by Manuel Leduc on 2023/10/16 11:19
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
![]() |
1.1 | 1 | {{toc/}} |
| 2 | |||
| 3 | == Introduction == | ||
| 4 | |||
| |
3.7 | 5 | This is a draft of the backend API which should be supported for each backend. A JS API will be defined which Cristal will interact with and the possible implementation on the server side will be indicated for each type of backend (XWiki, NextCloud, GitHub, LocalDrive). |
![]() |
1.1 | 6 | |
| 7 | The APIs in this document are an early draft. | ||
| 8 | |||
| 9 | == Authentication == | ||
| 10 | |||
| 11 | Authentication is a complex problem and needs to be studied. Multiple authentication methods should be possible: | ||
| 12 | |||
| 13 | * Providing a username/password and authenticating on the backend and receive a cookie or a token | ||
| 14 | * Open a Window to follow an authentication flow and generate either a cookie or a token | ||
| 15 | * Follow up requests should be succesful using the cookie or a token to insert the credentials in each HTTP request | ||
| 16 | |||
| 17 | * backend.authentication.getConfig | ||
| 18 | * backend.authentication.auth | ||
| 19 | * backend.authentication.authUsingAuthenticationFlow (not sure it's needed) | ||
| 20 | * backend.authentication.refreshAuth | ||
| 21 | * backend.authentication.forgetAuth | ||
| 22 | * backend.authentication.verifyAuth | ||
| 23 | * backend.authentication.addCredentialsToRequest(httprequest) | ||
| 24 | * backend.askForCredentials (if custom credentials UI) | ||
| 25 | |||
| 26 | Associated Wiki 3.0 api | ||
| 27 | |||
| 28 | * wiki30.askForCredentials | ||
| 29 | |||
![]() |
1.2 | 30 | TODO: verify that this API would support SSO OIDC authentication using XWiki. |
| 31 | |||
![]() |
1.1 | 32 | == Storage == |
| 33 | |||
| 34 | |||
![]() |
1.5 | 35 | * (JSON-LD) backend.storage.getDocument(reference) |
![]() |
1.3 | 36 | ** document has a syntaxID |
![]() |
1.5 | 37 | * backend.storage.saveDocument(reference, JSON-LD) |
| 38 | * backend.storage.exists(reference) | ||
| 39 | * backend.storage.getAttachment(reference) | ||
| 40 | * backend.storage.saveAttachment(reference) | ||
| 41 | * backend.storage.getComments(reference) | ||
| 42 | * backend.storage.addComment(reference) | ||
| 43 | * backend.storage.updateComment(reference) | ||
| 44 | * backend.storage.renameDocument(reference, newtitle, newreference) | ||
| 45 | * backend.storage.copyDocument(reference, newtitle, newreference) | ||
![]() |
1.3 | 46 | * backend.storage.query (similar to xwiki query API with multiple APIs) |
![]() |
3.4 | 47 | * backend.storage.getPageNamingStrategy(reference) |
| 48 | * backend.storage.convertReference(reference, pageNamingStrategy) | ||
![]() |
1.1 | 49 | |
![]() |
1.5 | 50 | TODO: check APIs needed for create screen |
| 51 | |||
![]() |
3.4 | 52 | TODO: study more page naming strategy |
![]() |
3.2 | 53 | |
![]() |
3.4 | 54 | |
![]() |
3.2 | 55 | === XWiki API === |
| 56 | |||
![]() |
3.3 | 57 | TODO |
| 58 | |||
![]() |
3.2 | 59 | === GitHub API === |
| 60 | |||
![]() |
3.5 | 61 | * config (storage strategy, filename escaping rules) |
| 62 | * convert reference to directories (using storage strategy) | ||
| 63 | ** each directory needs to be safe from a directory name pov | ||
| 64 | ** filename needs to be safe from a directory pov | ||
| 65 | * save file as JSON-LD using GitHub API | ||
![]() |
3.3 | 66 | |
![]() |
3.2 | 67 | === NextCloud API === |
| 68 | |||
![]() |
3.5 | 69 | * config (storage strategy, filename escaping rules) |
| 70 | * convert reference to directories (using storage strategy) | ||
| 71 | ** each directory needs to be safe from a directory name pov | ||
| 72 | ** filename needs to be safe from a directory pov | ||
| 73 | * save file as JSON-LD using WebDAV | ||
![]() |
3.2 | 74 | |
![]() |
3.3 | 75 | === File API === |
| 76 | |||
| 77 | TODO | ||
| 78 | |||
![]() |
3.5 | 79 | * config (storage strategy, filename escaping rules) |
| 80 | * convert reference to directories (using storage strategy) | ||
| 81 | ** each directory needs to be safe from a directory name pov | ||
| 82 | ** filename needs to be safe from a directory pov | ||
![]() |
3.4 | 83 | * save file as JSON-LD on disk |
| 84 | |||
![]() |
1.3 | 85 | == Rendering (server side rendering) == |
| 86 | |||
| 87 | * backend.storage.renderDocument | ||
| 88 | * backend.storage.renderMacro | ||
| 89 | |||
![]() |
3.1 | 90 | == LiveData == |
![]() |
1.3 | 91 | |
| 92 | TODO: based on LiveData API |
