-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix OIDC reauthentication when a session is involved #1719
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
base: main
Are you sure you want to change the base?
Conversation
public void reauthenticate(final InternalConnection connection, final OperationContext operationContext) { | ||
authenticate(connection, connection.getDescription(), operationContext); | ||
authenticate(connection, connection.getDescription(), operationContext.withSessionContext(NoOpSessionContext.INSTANCE)); | ||
} | ||
|
||
public void reauthenticateAsync(final InternalConnection connection, final OperationContext operationContext, | ||
final SingleResultCallback<Void> callback) { | ||
beginAsync().thenRun((c) -> { | ||
authenticateAsync(connection, connection.getDescription(), operationContext, c); | ||
authenticateAsync(connection, connection.getDescription(), operationContext.withSessionContext(NoOpSessionContext.INSTANCE), c); | ||
}).finish(callback); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OperationContext
for the first authentication when we establish a connection comes from MongoClusterImpl.OperationExecutorImpl.getOperationContext
, and does not have a SessionContext
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The one difference is the use of ReadConcernAwareNoOpSessionContext
instead of NoOpSessionContext
. I doubt it matters, but I don't remember why that class was needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Started using ReadConcernAwareNoOpSessionContext
in df84c84 just in case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, and approved for backport as well.
This PR is waiting for mongodb/specifications#1805.
JAVA-5880