-
Notifications
You must be signed in to change notification settings - Fork 155
Update AuthToken rotation to support more auth types #1481
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
76 changes: 76 additions & 0 deletions
76
driver/src/main/java/org/neo4j/driver/exceptions/SecurityRetryableException.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,76 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.neo4j.driver.exceptions; | ||
|
||
import java.io.Serial; | ||
import java.util.Objects; | ||
import org.neo4j.driver.AuthToken; | ||
import org.neo4j.driver.util.Experimental; | ||
import org.neo4j.driver.util.Preview; | ||
|
||
/** | ||
* Indicates that the contained {@link SecurityException} is a {@link RetryableException}, which is determined by the | ||
* {@link org.neo4j.driver.AuthTokenManager#handleSecurityException(AuthToken, SecurityException)} method. | ||
* <p> | ||
* The original {@link java.lang.SecurityException} is always available as a {@link Throwable#getCause()}. The | ||
* {@link SecurityRetryableException#code()} and {@link SecurityRetryableException#getMessage()} supply the values from | ||
* the original exception. | ||
* | ||
* @since 5.12 | ||
*/ | ||
@Preview(name = "AuthToken rotation and session auth support") | ||
public class SecurityRetryableException extends SecurityException implements RetryableException { | ||
@Serial | ||
private static final long serialVersionUID = 3914900631374208080L; | ||
|
||
/** | ||
* The original security exception. | ||
*/ | ||
private final SecurityException exception; | ||
|
||
/** | ||
* Creates a new instance. | ||
* | ||
* @param exception the original security exception, must not be {@code null} | ||
*/ | ||
public SecurityRetryableException(SecurityException exception) { | ||
super(exception.getMessage(), exception); | ||
this.exception = Objects.requireNonNull(exception); | ||
} | ||
|
||
@Override | ||
public String code() { | ||
return exception.code(); | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return exception.getMessage(); | ||
} | ||
|
||
/** | ||
* Returns the original security exception. | ||
* | ||
* @return the original security exception | ||
*/ | ||
@Experimental | ||
public SecurityException securityException() { | ||
return exception; | ||
} | ||
} |
50 changes: 0 additions & 50 deletions
50
driver/src/main/java/org/neo4j/driver/exceptions/TokenExpiredRetryableException.java
This file was deleted.
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.