3636import java .util .function .Function ;
3737import java .util .function .Supplier ;
3838import org .neo4j .driver .internal .bolt .api .AccessMode ;
39+ import org .neo4j .driver .internal .bolt .api .AuthToken ;
3940import org .neo4j .driver .internal .bolt .api .BasicResponseHandler ;
4041import org .neo4j .driver .internal .bolt .api .BoltAgent ;
4142import org .neo4j .driver .internal .bolt .api .BoltConnection ;
5152import org .neo4j .driver .internal .bolt .api .SecurityPlan ;
5253import org .neo4j .driver .internal .bolt .api .exception .BoltTransientException ;
5354import org .neo4j .driver .internal .bolt .api .exception .MinVersionAcquisitionException ;
54- import org .neo4j .driver .internal .bolt .api .values .Value ;
5555import org .neo4j .driver .internal .bolt .pooledimpl .impl .PooledBoltConnection ;
5656import org .neo4j .driver .internal .bolt .pooledimpl .impl .util .FutureUtil ;
5757
@@ -129,7 +129,7 @@ public CompletionStage<Void> init(
129129 public CompletionStage <BoltConnection > connect (
130130 SecurityPlan securityPlan ,
131131 DatabaseName databaseName ,
132- Supplier <CompletionStage <Map < String , Value >>> authMapStageSupplier ,
132+ Supplier <CompletionStage <AuthToken >> authTokenStageSupplier ,
133133 AccessMode mode ,
134134 Set <String > bookmarks ,
135135 String impersonatedUser ,
@@ -145,7 +145,7 @@ public CompletionStage<BoltConnection> connect(
145145
146146 var acquisitionFuture = new CompletableFuture <PooledBoltConnection >();
147147
148- authMapStageSupplier .get ().whenComplete ((authMap , authThrowable ) -> {
148+ authTokenStageSupplier .get ().whenComplete ((authToken , authThrowable ) -> {
149149 if (authThrowable != null ) {
150150 acquisitionFuture .completeExceptionally (authThrowable );
151151 return ;
@@ -168,8 +168,8 @@ public CompletionStage<BoltConnection> connect(
168168 acquisitionFuture ,
169169 securityPlan ,
170170 databaseName ,
171- authMap ,
172- authMapStageSupplier ,
171+ authToken ,
172+ authTokenStageSupplier ,
173173 mode ,
174174 bookmarks ,
175175 impersonatedUser ,
@@ -191,8 +191,8 @@ private void connect(
191191 CompletableFuture <PooledBoltConnection > acquisitionFuture ,
192192 SecurityPlan securityPlan ,
193193 DatabaseName databaseName ,
194- Map < String , Value > authMap ,
195- Supplier <CompletionStage <Map < String , Value >>> authMapStageSupplier ,
194+ AuthToken authToken ,
195+ Supplier <CompletionStage <AuthToken >> authTokenStageSupplier ,
196196 AccessMode mode ,
197197 Set <String > bookmarks ,
198198 String impersonatedUser ,
@@ -207,7 +207,7 @@ private void connect(
207207 empty .set (pooledConnectionEntries .isEmpty ());
208208 try {
209209 // go over existing entries first
210- connectionEntryWithMetadata = acquireExistingEntry (authMap , minVersion );
210+ connectionEntryWithMetadata = acquireExistingEntry (authToken , minVersion );
211211 } catch (MinVersionAcquisitionException e ) {
212212 acquisitionFuture .completeExceptionally (e );
213213 return ;
@@ -284,8 +284,8 @@ private void connect(
284284 acquisitionFuture ,
285285 securityPlan ,
286286 databaseName ,
287- authMap ,
288- authMapStageSupplier ,
287+ authToken ,
288+ authTokenStageSupplier ,
289289 mode ,
290290 bookmarks ,
291291 impersonatedUser ,
@@ -305,7 +305,7 @@ private void connect(
305305 purge (entry );
306306 metricsListener .afterConnectionReleased (poolId , inUseEvent );
307307 });
308- reauthStage (entryWithMetadata , authMap ).whenComplete ((ignored2 , throwable2 ) -> {
308+ reauthStage (entryWithMetadata , authToken ).whenComplete ((ignored2 , throwable2 ) -> {
309309 if (!acquisitionFuture .complete (pooledConnection )) {
310310 // acquisition timed out
311311 CompletableFuture <PooledBoltConnection > pendingAcquisition ;
@@ -336,7 +336,9 @@ private void connect(
336336 .connect (
337337 securityPlan ,
338338 databaseName ,
339- empty .get () ? () -> CompletableFuture .completedStage (authMap ) : authMapStageSupplier ,
339+ empty .get ()
340+ ? () -> CompletableFuture .completedStage (authToken )
341+ : authTokenStageSupplier ,
340342 mode ,
341343 bookmarks ,
342344 impersonatedUser ,
@@ -395,7 +397,7 @@ private void connect(
395397 }
396398
397399 private synchronized ConnectionEntryWithMetadata acquireExistingEntry (
398- Map < String , Value > authMap , BoltProtocolVersion minVersion ) {
400+ AuthToken authToken , BoltProtocolVersion minVersion ) {
399401 ConnectionEntryWithMetadata connectionEntryWithMetadata = null ;
400402 var iterator = pooledConnectionEntries .iterator ();
401403 while (iterator .hasNext ()) {
@@ -431,10 +433,10 @@ private synchronized ConnectionEntryWithMetadata acquireExistingEntry(
431433 }
432434
433435 // the pool must not have unauthenticated connections
434- var authData = connection .authData ().toCompletableFuture ().getNow (null );
436+ var authInfo = connection .authInfo ().toCompletableFuture ().getNow (null );
435437
436- var expiredByError = minAuthTimestamp > 0 && authData .authAckMillis () <= minAuthTimestamp ;
437- var authMatches = authMap .equals (authData . authMap ());
438+ var expiredByError = minAuthTimestamp > 0 && authInfo .authAckMillis () <= minAuthTimestamp ;
439+ var authMatches = authToken .equals (authInfo . authToken ());
438440 var reauthNeeded = expiredByError || !authMatches ;
439441
440442 if (reauthNeeded ) {
@@ -461,14 +463,14 @@ private synchronized ConnectionEntryWithMetadata acquireExistingEntry(
461463 }
462464
463465 private CompletionStage <Void > reauthStage (
464- ConnectionEntryWithMetadata connectionEntryWithMetadata , Map < String , Value > authMap ) {
466+ ConnectionEntryWithMetadata connectionEntryWithMetadata , AuthToken authToken ) {
465467 CompletionStage <Void > stage ;
466468 if (connectionEntryWithMetadata .reauthNeeded ) {
467469 stage = connectionEntryWithMetadata
468470 .connectionEntry
469471 .connection
470472 .logoff ()
471- .thenCompose (conn -> conn .logon (authMap ))
473+ .thenCompose (conn -> conn .logon (authToken ))
472474 .handle ((ignored , throwable ) -> {
473475 if (throwable != null ) {
474476 connectionEntryWithMetadata .connectionEntry .connection .close ();
@@ -500,11 +502,11 @@ private CompletionStage<Void> livenessCheckStage(ConnectionEntry entry) {
500502 }
501503
502504 @ Override
503- public CompletionStage <Void > verifyConnectivity (SecurityPlan securityPlan , Map < String , Value > authMap ) {
505+ public CompletionStage <Void > verifyConnectivity (SecurityPlan securityPlan , AuthToken authToken ) {
504506 return connect (
505507 securityPlan ,
506508 null ,
507- () -> CompletableFuture .completedStage (authMap ),
509+ () -> CompletableFuture .completedStage (authToken ),
508510 AccessMode .WRITE ,
509511 Collections .emptySet (),
510512 null ,
@@ -516,11 +518,11 @@ public CompletionStage<Void> verifyConnectivity(SecurityPlan securityPlan, Map<S
516518 }
517519
518520 @ Override
519- public CompletionStage <Boolean > supportsMultiDb (SecurityPlan securityPlan , Map < String , Value > authMap ) {
521+ public CompletionStage <Boolean > supportsMultiDb (SecurityPlan securityPlan , AuthToken authToken ) {
520522 return connect (
521523 securityPlan ,
522524 null ,
523- () -> CompletableFuture .completedStage (authMap ),
525+ () -> CompletableFuture .completedStage (authToken ),
524526 AccessMode .WRITE ,
525527 Collections .emptySet (),
526528 null ,
@@ -535,11 +537,11 @@ public CompletionStage<Boolean> supportsMultiDb(SecurityPlan securityPlan, Map<S
535537 }
536538
537539 @ Override
538- public CompletionStage <Boolean > supportsSessionAuth (SecurityPlan securityPlan , Map < String , Value > authMap ) {
540+ public CompletionStage <Boolean > supportsSessionAuth (SecurityPlan securityPlan , AuthToken authToken ) {
539541 return connect (
540542 securityPlan ,
541543 null ,
542- () -> CompletableFuture .completedStage (authMap ),
544+ () -> CompletableFuture .completedStage (authToken ),
543545 AccessMode .WRITE ,
544546 Collections .emptySet (),
545547 null ,
0 commit comments