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

fix: Deprecate and stop firing JS token refresh event #6317

Merged
merged 1 commit into from
Nov 8, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,19 @@ public class CoreClient extends HasEventHandling {
EVENT_DISCONNECT = "disconnect",
EVENT_RECONNECT = "reconnect",
EVENT_RECONNECT_AUTH_FAILED = "reconnectauthfailed",
EVENT_REFRESH_TOKEN_UPDATED = "refreshtokenupdated",
EVENT_REQUEST_FAILED = "requestfailed",
EVENT_REQUEST_STARTED = "requeststarted",
EVENT_REQUEST_SUCCEEDED = "requestsucceeded";

@Deprecated
public static final String EVENT_REFRESH_TOKEN_UPDATED = "refreshtokenupdated";
public static final String LOGIN_TYPE_PASSWORD = "password",
LOGIN_TYPE_ANONYMOUS = "anonymous";

private final IdeConnection ideConnection;

public CoreClient(String serverUrl, @TsTypeRef(ConnectOptions.class) @JsOptional Object connectOptions) {
ideConnection = new IdeConnection(serverUrl, connectOptions);

// For now the only real connection is the IdeConnection, so we re-fire the auth token refresh
// event here for the UI to listen to
ideConnection.addEventListener(EVENT_REFRESH_TOKEN_UPDATED, this::fireEvent);
}

private <R> Promise<String[][]> getConfigs(Consumer<JsBiConsumer<Object, R>> rpcCall,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@
import java.util.function.Consumer;
import java.util.stream.Collectors;

import static io.deephaven.web.client.api.CoreClient.EVENT_REFRESH_TOKEN_UPDATED;

/**
* Non-exported class, manages the connection to a given worker server. Exported types like QueryInfo and Table will
* refer to this, and allow us to try to keep track of how many open tables there are, so we can close the connection if
Expand Down Expand Up @@ -464,8 +462,6 @@ private Promise<Void> authUpdate() {
if (!existing.getAt(0).equals(authorization.getAt(0))) {
// use this new token
metadata().set(FLIGHT_AUTH_HEADER_NAME, authorization);
info.fireEvent(EVENT_REFRESH_TOKEN_UPDATED,
new JsRefreshToken(authorization.getAt(0), sessionTimeoutMs));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class IdeConnection extends QueryConnectable<IdeConnection> {
* @param serverUrl The url used when connecting to the server. Read-only.
* @param connectOptions Optional Object
*/
@JsIgnore
public IdeConnection(String serverUrl, Object connectOptions) {
// Remove trailing slashes from the url
this.serverUrl = serverUrl.replaceAll("/+$", "");
Expand Down