Repository navigation
dbeaver/pro#12096 Define authenticated Dam session reconnects #56
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
Open
vkirst
wants to merge
8
commits into
devel
Choose a base branch
from
dbeaver/pro#12096-Bind-Remote-Dam-session-ownership
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b7cbabe
dbeaver/pro#12096 Define the Remote Dam reconnect protocol
vkirst f1c9afb
dbeaver/pro#12096 Define the Remote Dam resume rejection code
vkirst 1df5828
dbeaver/pro#12096 Require a new secret in Dam resume requests
vkirst 0558a3e
dbeaver/pro#12096 Document the Dam session resume protocol
vkirst b1a4201
dbeaver/pro#12096 Define the Dam session expiration close code
vkirst c3bdb0e
dbeaver/pro#12096 Add the persistent Dam credential to the registrati…
vkirst d3f60cf
dbeaver/pro#12096 Simplify the Dam session resume protocol
vkirst 175372c
Merge branch 'devel' into dbeaver/pro#12096-Bind-Remote-Dam-session-o…
vkirst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...rc/main/java/com/dbeaver/datadam/dam/remote/api/model/DDRemoteDamRegistrationRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /* | ||
| * DBeaver - Universal Database Manager | ||
| * Copyright (C) 2010-2026 DBeaver Corp | ||
| * | ||
| * All Rights Reserved. | ||
| * | ||
| * NOTICE: All information contained herein is, and remains | ||
| * the property of DBeaver Corp and its suppliers, if any. | ||
| * The intellectual and technical concepts contained | ||
| * herein are proprietary to DBeaver Corp and its suppliers | ||
| * and may be covered by U.S. and Foreign Patents, | ||
| * patents in process, and are protected by trade secret or copyright law. | ||
| * Dissemination of this information or reproduction of this material | ||
| * is strictly forbidden unless prior written permission is obtained | ||
| * from DBeaver Corp. | ||
| */ | ||
| package com.dbeaver.datadam.dam.remote.api.model; | ||
|
|
||
| import org.jkiss.code.NotNull; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| public sealed interface DDRemoteDamRegistrationRequest | ||
|
Check warning on line 23 in apis/com.dbeaver.datadam.dam.remote.api/src/main/java/com/dbeaver/datadam/dam/remote/api/model/DDRemoteDamRegistrationRequest.java
|
||
| permits DDRemoteDamHandshakeRequest, DDRemoteDamRegistrationRequest.Hello, DDRemoteDamRegistrationRequest.Resume { | ||
|
|
||
| record Hello( | ||
| @NotNull DDRemoteDamHandshakeRequest request, | ||
| @NotNull DDRemoteDamSecret damSecret | ||
| ) implements DDRemoteDamRegistrationRequest { | ||
| public Hello { | ||
| Objects.requireNonNull(request); | ||
| Objects.requireNonNull(damSecret); | ||
| } | ||
| } | ||
|
|
||
| record Resume( | ||
| @NotNull String damSessionId, | ||
| @NotNull DDRemoteDamSecret damSecret | ||
| ) implements DDRemoteDamRegistrationRequest { | ||
| static final int MAX_SESSION_ID_LENGTH = 256; | ||
|
|
||
| public Resume { | ||
| Objects.requireNonNull(damSecret); | ||
| DDRemoteDamMessage.requireText(damSessionId, "damSessionId"); | ||
| if (damSessionId.length() > MAX_SESSION_ID_LENGTH) { | ||
| throw new IllegalArgumentException("Dam session ID is too long"); | ||
| } | ||
| } | ||
| } | ||
| } | ||
45 changes: 45 additions & 0 deletions
45
....remote.api/src/main/java/com/dbeaver/datadam/dam/remote/api/model/DDRemoteDamSecret.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| * DBeaver - Universal Database Manager | ||
| * Copyright (C) 2010-2026 DBeaver Corp | ||
| * | ||
| * All Rights Reserved. | ||
| * | ||
| * NOTICE: All information contained herein is, and remains | ||
| * the property of DBeaver Corp and its suppliers, if any. | ||
| * The intellectual and technical concepts contained | ||
| * herein are proprietary to DBeaver Corp and its suppliers | ||
| * and may be covered by U.S. and Foreign Patents, | ||
| * patents in process, and are protected by trade secret or copyright law. | ||
| * Dissemination of this information or reproduction of this material | ||
| * is strictly forbidden unless prior written permission is obtained | ||
| * from DBeaver Corp. | ||
| */ | ||
| package com.dbeaver.datadam.dam.remote.api.model; | ||
|
|
||
| import org.jkiss.code.NotNull; | ||
| import org.jkiss.code.Nullable; | ||
|
|
||
| import java.util.Base64; | ||
| import java.util.regex.Pattern; | ||
|
|
||
| public record DDRemoteDamSecret(@NotNull String value) { | ||
| private static final Pattern ENCODED = Pattern.compile("[A-Za-z0-9_-]{43}"); | ||
| private static final Base64.Encoder ENCODER = Base64.getUrlEncoder().withoutPadding(); | ||
|
|
||
| public DDRemoteDamSecret { | ||
| if (!isCanonicalEncoding(value)) { | ||
| throw new IllegalArgumentException("Invalid Dam secret"); | ||
| } | ||
| } | ||
|
|
||
| private static boolean isCanonicalEncoding(@Nullable String value) { | ||
| return value != null && ENCODED.matcher(value).matches() | ||
| && ENCODER.encodeToString(Base64.getUrlDecoder().decode(value)).equals(value); | ||
| } | ||
|
|
||
| @Override | ||
| @NotNull | ||
| public String toString() { | ||
| return "DDRemoteDamSecret[<redacted>]"; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.