mirror of
https://github.com/outline/outline.git
synced 2026-11-20 21:23:06 +03:00
* feat: Re-authorize collaboration connections when access changes Collaboration connections are authorized once, when the websocket is first established, so a connection outlives changes to the access it was granted. Add a processor that publishes access changes to the collaboration servers over Redis. Each server closes the connections it holds within the scope of the change and clients reconnect, at which point they are authorized as normal. Authorization stays in one place, the published scope only has to cover the connections that may be affected. The API update subscriber now shares a single Redis connection rather than opening its own. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * refactor: Log an access change once rather than per connection Every closed connection is already logged by LoggerExtension, so record the reason and the number of connections affected once instead. The count also makes a scope that matches nothing visible. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
63 lines
1.5 KiB
TypeScript
63 lines
1.5 KiB
TypeScript
/**
|
|
* The server is terminating the connection because a data frame was received
|
|
* that is too large.
|
|
* See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code
|
|
*/
|
|
export const DocumentTooLarge = {
|
|
code: 1009,
|
|
reason: "Document Too Large",
|
|
};
|
|
|
|
/**
|
|
* Similar to AuthorizationFailed, but specifically for use when authentication is required and has
|
|
* failed or has not yet been provided.
|
|
*/
|
|
export const AuthenticationFailed = {
|
|
code: 4401,
|
|
reason: "Authentication Failed",
|
|
};
|
|
|
|
/**
|
|
* The request contained valid data and was understood by the server, but the server
|
|
* is refusing action.
|
|
*/
|
|
export const AuthorizationFailed = {
|
|
code: 4403,
|
|
reason: "Authorization Failed",
|
|
};
|
|
|
|
/**
|
|
* The access the user was granted may have changed and must be established
|
|
* again. The client is expected to reconnect, at which point it is either
|
|
* authorized as normal or refused with `AuthorizationFailed`.
|
|
*/
|
|
export const AuthorizationChanged = {
|
|
code: 4205,
|
|
reason: "Authorization Changed",
|
|
};
|
|
|
|
/**
|
|
* The server is refusing to process the request because there are too many connections
|
|
* to the given document.
|
|
*/
|
|
export const TooManyConnections = {
|
|
code: 4503,
|
|
reason: "Too Many Connections",
|
|
};
|
|
|
|
/**
|
|
* The client must update their editor to continue collaborating.
|
|
*/
|
|
export const EditorUpdateError = {
|
|
code: 4999,
|
|
reason: "Editor Update Required",
|
|
};
|
|
|
|
/**
|
|
* The server timed out waiting for the request.
|
|
*/
|
|
export const ConnectionTimeout = {
|
|
code: 4408,
|
|
reason: "Connection Timeout",
|
|
};
|