diff --git a/agdb_api/php/README.md b/agdb_api/php/README.md index c2d92144..57e033bb 100644 --- a/agdb_api/php/README.md +++ b/agdb_api/php/README.md @@ -104,7 +104,7 @@ Class | Method | HTTP request | Description *AgdbApi* | [**clusterAdminUserLogout**](docs/Api/AgdbApi.md#clusteradminuserlogout) | **POST** /api/v1/cluster/admin/user/{username}/logout | *AgdbApi* | [**clusterStatus**](docs/Api/AgdbApi.md#clusterstatus) | **GET** /api/v1/cluster/status | *AgdbApi* | [**clusterUserLogin**](docs/Api/AgdbApi.md#clusteruserlogin) | **POST** /api/v1/cluster/user/login | -*AgdbApi* | [**clusterUserLogout**](docs/Api/AgdbApi.md#clusteruserlogout) | **POST** /api/v1/cluster/logout | +*AgdbApi* | [**clusterUserLogout**](docs/Api/AgdbApi.md#clusteruserlogout) | **POST** /api/v1/cluster/user/logout | *AgdbApi* | [**dbAdd**](docs/Api/AgdbApi.md#dbadd) | **POST** /api/v1/db/{owner}/{db}/add | *AgdbApi* | [**dbAudit**](docs/Api/AgdbApi.md#dbaudit) | **GET** /api/v1/db/{owner}/{db}/audit | *AgdbApi* | [**dbBackup**](docs/Api/AgdbApi.md#dbbackup) | **POST** /api/v1/db/{owner}/{db}/backup | diff --git a/agdb_api/php/docs/Api/AgdbApi.md b/agdb_api/php/docs/Api/AgdbApi.md index 51c21996..668d34ba 100644 --- a/agdb_api/php/docs/Api/AgdbApi.md +++ b/agdb_api/php/docs/Api/AgdbApi.md @@ -31,7 +31,7 @@ All URIs are relative to http://localhost:3000, except if the operation defines | [**clusterAdminUserLogout()**](AgdbApi.md#clusterAdminUserLogout) | **POST** /api/v1/cluster/admin/user/{username}/logout | | | [**clusterStatus()**](AgdbApi.md#clusterStatus) | **GET** /api/v1/cluster/status | | | [**clusterUserLogin()**](AgdbApi.md#clusterUserLogin) | **POST** /api/v1/cluster/user/login | | -| [**clusterUserLogout()**](AgdbApi.md#clusterUserLogout) | **POST** /api/v1/cluster/logout | | +| [**clusterUserLogout()**](AgdbApi.md#clusterUserLogout) | **POST** /api/v1/cluster/user/logout | | | [**dbAdd()**](AgdbApi.md#dbAdd) | **POST** /api/v1/db/{owner}/{db}/add | | | [**dbAudit()**](AgdbApi.md#dbAudit) | **GET** /api/v1/db/{owner}/{db}/audit | | | [**dbBackup()**](AgdbApi.md#dbBackup) | **POST** /api/v1/db/{owner}/{db}/backup | | diff --git a/agdb_api/php/lib/Api/AgdbApi.php b/agdb_api/php/lib/Api/AgdbApi.php index e494f044..49a139c5 100644 --- a/agdb_api/php/lib/Api/AgdbApi.php +++ b/agdb_api/php/lib/Api/AgdbApi.php @@ -7732,7 +7732,7 @@ public function clusterUserLogoutRequest(string $contentType = self::contentType { - $resourcePath = '/api/v1/cluster/logout'; + $resourcePath = '/api/v1/cluster/user/logout'; $formParams = []; $queryParams = []; $headerParams = []; diff --git a/agdb_api/typescript/src/openapi.d.ts b/agdb_api/typescript/src/openapi.d.ts index ccfff6ef..1429cb0b 100644 --- a/agdb_api/typescript/src/openapi.d.ts +++ b/agdb_api/typescript/src/openapi.d.ts @@ -2485,14 +2485,6 @@ export interface OperationMethods { data?: any, config?: AxiosRequestConfig ): OperationResponse - /** - * cluster_user_logout - */ - 'cluster_user_logout'( - parameters?: Parameters | null, - data?: any, - config?: AxiosRequestConfig - ): OperationResponse /** * cluster_status */ @@ -2509,6 +2501,14 @@ export interface OperationMethods { data?: Paths.ClusterUserLogin.RequestBody, config?: AxiosRequestConfig ): OperationResponse + /** + * cluster_user_logout + */ + 'cluster_user_logout'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse /** * db_list */ @@ -2938,16 +2938,6 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse } - ['/api/v1/cluster/logout']: { - /** - * cluster_user_logout - */ - 'post'( - parameters?: Parameters | null, - data?: any, - config?: AxiosRequestConfig - ): OperationResponse - } ['/api/v1/cluster/status']: { /** * cluster_status @@ -2968,6 +2958,16 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse } + ['/api/v1/cluster/user/logout']: { + /** + * cluster_user_logout + */ + 'post'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse + } ['/api/v1/db/list']: { /** * db_list diff --git a/agdb_server/openapi.json b/agdb_server/openapi.json index c0795f85..5e7f74b9 100644 --- a/agdb_server/openapi.json +++ b/agdb_server/openapi.json @@ -1213,27 +1213,6 @@ ] } }, - "/api/v1/cluster/logout": { - "post": { - "tags": [ - "agdb" - ], - "operationId": "cluster_user_logout", - "responses": { - "201": { - "description": "user logged out" - }, - "401": { - "description": "invalid credentials" - } - }, - "security": [ - { - "Token": [] - } - ] - } - }, "/api/v1/cluster/status": { "get": { "tags": [ @@ -1290,6 +1269,27 @@ } } }, + "/api/v1/cluster/user/logout": { + "post": { + "tags": [ + "agdb" + ], + "operationId": "cluster_user_logout", + "responses": { + "201": { + "description": "user logged out" + }, + "401": { + "description": "invalid credentials" + } + }, + "security": [ + { + "Token": [] + } + ] + } + }, "/api/v1/db/list": { "get": { "tags": [ diff --git a/agdb_server/src/routes/cluster.rs b/agdb_server/src/routes/cluster.rs index 971dd3b2..e50a490f 100644 --- a/agdb_server/src/routes/cluster.rs +++ b/agdb_server/src/routes/cluster.rs @@ -95,7 +95,7 @@ pub(crate) async fn login( } #[utoipa::path(post, - path = "/api/v1/cluster/logout", + path = "/api/v1/cluster/user/logout", operation_id = "cluster_user_logout", tag = "agdb", security(("Token" = [])), diff --git a/agdb_web/pages/en-US/docs/references/server.mdx b/agdb_web/pages/en-US/docs/references/server.mdx index de580f7c..40ffab0e 100644 --- a/agdb_web/pages/en-US/docs/references/server.mdx +++ b/agdb_web/pages/en-US/docs/references/server.mdx @@ -79,12 +79,14 @@ Users are allowed to change their password and to create and manipulate database Available user APIs: -| Action | Description | -| ---------------------------- | ------------------------------------------------------------------- | -| /api/v1/user/change_password | changes the current user's password | -| /api/v1/user/login | logs in the user returning an API token | -| /api/v1/user/logout | logs out the user and invalidating the API token \* | -| /api/v1/user/status | returns current user's username and whether it is a server admin \* | +| Action | Description | +| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| /api/v1/user/change_password | changes the current user's password | +| /api/v1/user/login | logs in the user returning an API token | +| /api/v1/user/logout | logs out the user and invalidating the API token \* | +| /api/v1/user/status | returns current user's username and whether it is a server admin \* | +| /api/v1/cluster/user/login | logs in the user cluster wide so that using the same token accessing other nodes will not require new login, this might overwrite existing tokens on other nodes | +| /api/v1/cluster/user/logout | invalidate tokens on all nodes in the cluster | The login is shared meaning if you log in twice even from different devices you will get the same shared API token of that user. Similarly, when the `logout` endpoint is used this token is invalidated across all sessions. @@ -186,6 +188,7 @@ Each `agdb_server` has exactly one admin account (`admin` by default) that acts | /api/v1/admin/user/\{username\}/logout | force logout of any user | | /api/v1/admin/user/\{username\}/remove | deletes user and all their data (databases) from the server | | /api/v1/admin/user/list | lists the all users on the server | +| /api/v1/cluster/admin/user/\{username\}/logout | force logout of any user from all nodes in the cluster | ## Shutdown @@ -260,20 +263,13 @@ The node0 will have the index `0`, the node1 will have the index `1` and node2 w care when doing it. -Available cluster endpoints: - -| Action | Description | -| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| /api/v1/cluster/status | returns the list of cluster nodes indicating which nodes are reachable from the current node and which node is the leader | -| /api/v1/cluster/user/login | logs in the user cluster wide so that using the same token accessing other nodes will not require new login, this might overwrite existing tokens on other nodes | -| /api/v1/cluster/user/logout | invalidate tokens on all nodes in the cluster | - ## Misc Following are the special or miscellaneous endpoints: -| Endpoint | Description | -| -------------------- | ---------------------------------------------------- | -| /api/v1 | serves rapidoc OpenAPI GUI (use this in the browser) | -| /api/v1/openapi.json | returns the server's OpenAPI specification as json | -| /api/v1/status | returns 200 OK if the server is ready (up) | +| Endpoint | Description | +| ---------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| /api/v1 | serves rapidoc OpenAPI GUI (use this in the browser) | +| /api/v1/openapi.json | returns the server's OpenAPI specification as json | +| /api/v1/status | returns 200 OK if the server is ready (up) | +| /api/v1/cluster/status | returns the list of cluster nodes indicating which nodes are reachable from the current node and which node is the leader |