Wiki source code of Backend API
Last modified by Manuel Leduc on 2023/10/16 11:19
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{toc/}} | ||
| 2 | |||
| 3 | == Introduction == | ||
| 4 | |||
| 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). | ||
| 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 | |||
| 30 | TODO: verify that this API would support SSO OIDC authentication using XWiki. | ||
| 31 | |||
| 32 | == Storage == | ||
| 33 | |||
| 34 | |||
| 35 | * (JSON-LD) backend.storage.getDocument(reference) | ||
| 36 | ** document has a syntaxID | ||
| 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) | ||
| 46 | * backend.storage.query (similar to xwiki query API with multiple APIs) | ||
| 47 | * backend.storage.getPageNamingStrategy(reference) | ||
| 48 | * backend.storage.convertReference(reference, pageNamingStrategy) | ||
| 49 | |||
| 50 | TODO: check APIs needed for create screen | ||
| 51 | |||
| 52 | TODO: study more page naming strategy | ||
| 53 | |||
| 54 | |||
| 55 | === XWiki API === | ||
| 56 | |||
| 57 | TODO | ||
| 58 | |||
| 59 | === GitHub API === | ||
| 60 | |||
| 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 | ||
| 66 | |||
| 67 | === NextCloud API === | ||
| 68 | |||
| 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 | ||
| 74 | |||
| 75 | === File API === | ||
| 76 | |||
| 77 | TODO | ||
| 78 | |||
| 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 | ||
| 83 | * save file as JSON-LD on disk | ||
| 84 | |||
| 85 | == Rendering (server side rendering) == | ||
| 86 | |||
| 87 | * backend.storage.renderDocument | ||
| 88 | * backend.storage.renderMacro | ||
| 89 | |||
| 90 | == LiveData == | ||
| 91 | |||
| 92 | TODO: based on LiveData API |