26
26
import com .arangodb .async .internal .ArangoDBAsyncImpl ;
27
27
import com .arangodb .async .internal .velocystream .VstCommunicationAsync ;
28
28
import com .arangodb .async .internal .velocystream .VstConnectionFactoryAsync ;
29
- import com .arangodb .entity .ArangoDBVersion ;
30
- import com .arangodb .entity .LoadBalancingStrategy ;
31
- import com .arangodb .entity .LogEntity ;
32
- import com .arangodb .entity .LogEntriesEntity ;
33
- import com .arangodb .entity .LogLevelEntity ;
34
- import com .arangodb .entity .Permissions ;
35
- import com .arangodb .entity .ServerRole ;
36
- import com .arangodb .entity .UserEntity ;
29
+ import com .arangodb .entity .*;
37
30
import com .arangodb .internal .ArangoContext ;
38
31
import com .arangodb .internal .ArangoDefaults ;
39
32
import com .arangodb .internal .InternalArangoDBBuilder ;
53
46
import com .arangodb .util .ArangoDeserializer ;
54
47
import com .arangodb .util .ArangoSerialization ;
55
48
import com .arangodb .util .ArangoSerializer ;
56
- import com .arangodb .velocypack .VPack ;
57
- import com .arangodb .velocypack .VPackAnnotationFieldFilter ;
58
- import com .arangodb .velocypack .VPackAnnotationFieldNaming ;
59
- import com .arangodb .velocypack .VPackDeserializer ;
60
- import com .arangodb .velocypack .VPackInstanceCreator ;
61
- import com .arangodb .velocypack .VPackJsonDeserializer ;
62
- import com .arangodb .velocypack .VPackJsonSerializer ;
63
- import com .arangodb .velocypack .VPackModule ;
64
- import com .arangodb .velocypack .VPackParser ;
65
- import com .arangodb .velocypack .VPackParserModule ;
66
- import com .arangodb .velocypack .VPackSerializer ;
67
- import com .arangodb .velocypack .ValueType ;
49
+ import com .arangodb .velocypack .*;
68
50
import com .arangodb .velocystream .Request ;
69
51
import com .arangodb .velocystream .Response ;
70
52
@@ -92,6 +74,14 @@ public interface ArangoDBAsync extends ArangoSerializationAccessor {
92
74
93
75
void shutdown () throws ArangoDBException ;
94
76
77
+ /**
78
+ * Updates the JWT used for requests authorization. It does not change already existing VST connections, since VST
79
+ * connections are authenticated during the initialization phase.
80
+ *
81
+ * @param jwt token to use
82
+ */
83
+ void updateJwt (String jwt );
84
+
95
85
/**
96
86
* Returns a handler of the system database
97
87
*
@@ -281,10 +271,8 @@ public interface ArangoDBAsync extends ArangoSerializationAccessor {
281
271
/**
282
272
* Returns fatal, error, warning or info log messages from the server's global log.
283
273
*
284
- * @param options
285
- * Additional options, can be null
274
+ * @param options Additional options, can be null
286
275
* @return the log messages
287
- *
288
276
* @see <a href= "https://www.arangodb.com/docs/stable/http/administration-and-monitoring.html#read-global-logs-from-the-server">API
289
277
* Documentation</a>
290
278
* @deprecated use {@link #getLogEntries(LogOptions)} instead
@@ -295,10 +283,8 @@ public interface ArangoDBAsync extends ArangoSerializationAccessor {
295
283
/**
296
284
* Returns the server logs
297
285
*
298
- * @param options
299
- * Additional options, can be null
286
+ * @param options Additional options, can be null
300
287
* @return the log messages
301
- *
302
288
* @see <a href= "https://www.arangodb.com/docs/stable/http/administration-and-monitoring.html#read-global-logs-from-the-server">API
303
289
* Documentation</a>
304
290
* @since ArangoDB 3.8
@@ -383,6 +369,17 @@ public Builder password(final String password) {
383
369
return this ;
384
370
}
385
371
372
+ /**
373
+ * Sets the JWT for the user authentication.
374
+ *
375
+ * @param jwt token to use (default: {@code null})
376
+ * @return {@link ArangoDBAsync.Builder}
377
+ */
378
+ public Builder jwt (final String jwt ) {
379
+ setJwt (jwt );
380
+ return this ;
381
+ }
382
+
386
383
/**
387
384
* If set to <code>true</code> SSL will be used when connecting to an ArangoDB server.
388
385
*
@@ -812,18 +809,20 @@ public synchronized ArangoDBAsync build() {
812
809
syncBuilder (syncHostHandler ),
813
810
asyncHostResolver ,
814
811
syncHostResolver ,
812
+ asyncHostHandler ,
813
+ syncHostHandler ,
815
814
new ArangoContext ());
816
815
}
817
816
818
817
private VstCommunicationAsync .Builder asyncBuilder (final HostHandler hostHandler ) {
819
818
return new VstCommunicationAsync .Builder (hostHandler ).timeout (timeout ).user (user ).password (password )
820
- .useSsl (useSsl ).sslContext (sslContext ).chunksize (chunksize ).maxConnections (maxConnections )
819
+ .jwt ( jwt ). useSsl (useSsl ).sslContext (sslContext ).chunksize (chunksize ).maxConnections (maxConnections )
821
820
.connectionTtl (connectionTtl );
822
821
}
823
822
824
823
private VstCommunicationSync .Builder syncBuilder (final HostHandler hostHandler ) {
825
824
return new VstCommunicationSync .Builder (hostHandler ).timeout (timeout ).user (user ).password (password )
826
- .useSsl (useSsl ).sslContext (sslContext ).chunksize (chunksize ).maxConnections (maxConnections )
825
+ .jwt ( jwt ). useSsl (useSsl ).sslContext (sslContext ).chunksize (chunksize ).maxConnections (maxConnections )
827
826
.connectionTtl (connectionTtl );
828
827
}
829
828
0 commit comments