Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Document cluster/admin/user/logout #1523 #1535

Merged
merged 3 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agdb_api/php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion agdb_api/php/docs/Api/AgdbApi.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion agdb_api/php/lib/Api/AgdbApi.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions agdb_api/typescript/src/openapi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2485,14 +2485,6 @@ export interface OperationMethods {
data?: any,
config?: AxiosRequestConfig
): OperationResponse<Paths.ClusterAdminUserLogout.Responses.$201>
/**
* cluster_user_logout
*/
'cluster_user_logout'(
parameters?: Parameters<UnknownParamsObject> | null,
data?: any,
config?: AxiosRequestConfig
): OperationResponse<Paths.ClusterUserLogout.Responses.$201>
/**
* cluster_status
*/
Expand All @@ -2509,6 +2501,14 @@ export interface OperationMethods {
data?: Paths.ClusterUserLogin.RequestBody,
config?: AxiosRequestConfig
): OperationResponse<Paths.ClusterUserLogin.Responses.$200>
/**
* cluster_user_logout
*/
'cluster_user_logout'(
parameters?: Parameters<UnknownParamsObject> | null,
data?: any,
config?: AxiosRequestConfig
): OperationResponse<Paths.ClusterUserLogout.Responses.$201>
/**
* db_list
*/
Expand Down Expand Up @@ -2938,16 +2938,6 @@ export interface PathsDictionary {
config?: AxiosRequestConfig
): OperationResponse<Paths.ClusterAdminUserLogout.Responses.$201>
}
['/api/v1/cluster/logout']: {
/**
* cluster_user_logout
*/
'post'(
parameters?: Parameters<UnknownParamsObject> | null,
data?: any,
config?: AxiosRequestConfig
): OperationResponse<Paths.ClusterUserLogout.Responses.$201>
}
['/api/v1/cluster/status']: {
/**
* cluster_status
Expand All @@ -2968,6 +2958,16 @@ export interface PathsDictionary {
config?: AxiosRequestConfig
): OperationResponse<Paths.ClusterUserLogin.Responses.$200>
}
['/api/v1/cluster/user/logout']: {
/**
* cluster_user_logout
*/
'post'(
parameters?: Parameters<UnknownParamsObject> | null,
data?: any,
config?: AxiosRequestConfig
): OperationResponse<Paths.ClusterUserLogout.Responses.$201>
}
['/api/v1/db/list']: {
/**
* db_list
Expand Down
42 changes: 21 additions & 21 deletions agdb_server/openapi.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion agdb_server/src/routes/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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" = [])),
Expand Down
34 changes: 15 additions & 19 deletions agdb_web/pages/en-US/docs/references/server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.
</Callout>

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 |
Loading