@@ -263,8 +263,8 @@ public AuthResponse createToken(final TokenRequest tokenRequest, final String to
263263 // HTTP request to Vault
264264 final RestResponse restResponse = new Rest ()//NOPMD
265265 .url (url )
266- .optionalHeader ("X-Vault-Token" , config .getToken ())
267- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
266+ .header ("X-Vault-Token" , config .getToken ())
267+ .header ("X-Vault-Namespace" , this .nameSpace )
268268 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
269269 .connectTimeoutSeconds (config .getOpenTimeout ())
270270 .readTimeoutSeconds (config .getReadTimeout ())
@@ -424,7 +424,7 @@ public AuthResponse loginByAppRole(final String path, final String roleId, final
424424 final String requestJson = Json .object ().add ("role_id" , roleId ).add ("secret_id" , secretId ).toString ();
425425 final RestResponse restResponse = new Rest ()//NOPMD
426426 .url (config .getAddress () + "/v1/auth/" + path + "/login" )
427- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
427+ .header ("X-Vault-Namespace" , this .nameSpace )
428428 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
429429 .connectTimeoutSeconds (config .getOpenTimeout ())
430430 .readTimeoutSeconds (config .getReadTimeout ())
@@ -507,7 +507,7 @@ public AuthResponse loginByUserPass(final String username, final String password
507507 final String requestJson = Json .object ().add ("password" , password ).toString ();
508508 final RestResponse restResponse = new Rest ()//NOPMD
509509 .url (config .getAddress () + "/v1/auth/" + mount + "/login/" + username )
510- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
510+ .header ("X-Vault-Namespace" , this .nameSpace )
511511 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
512512 .connectTimeoutSeconds (config .getOpenTimeout ())
513513 .readTimeoutSeconds (config .getReadTimeout ())
@@ -630,7 +630,7 @@ public AuthResponse loginByAwsEc2(final String role, final String identity, fina
630630 final RestResponse restResponse = new Rest ()//NOPMD
631631 .url (config .getAddress () + "/v1/auth/" + mount + "/login" )
632632 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
633- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
633+ .header ("X-Vault-Namespace" , this .nameSpace )
634634 .connectTimeoutSeconds (config .getOpenTimeout ())
635635 .readTimeoutSeconds (config .getReadTimeout ())
636636 .sslVerification (config .getSslConfig ().isVerify ())
@@ -705,7 +705,7 @@ public AuthResponse loginByAwsEc2(final String role, final String pkcs7, final S
705705 final String requestJson = request .toString ();
706706 final RestResponse restResponse = new Rest ()//NOPMD
707707 .url (config .getAddress () + "/v1/auth/" + mount + "/login" )
708- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
708+ .header ("X-Vault-Namespace" , this .nameSpace )
709709 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
710710 .connectTimeoutSeconds (config .getOpenTimeout ())
711711 .readTimeoutSeconds (config .getReadTimeout ())
@@ -784,7 +784,7 @@ public AuthResponse loginByAwsIam(final String role, final String iamRequestUrl,
784784 final String requestJson = request .toString ();
785785 final RestResponse restResponse = new Rest ()//NOPMD
786786 .url (config .getAddress () + "/v1/auth/" + mount + "/login" )
787- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
787+ .header ("X-Vault-Namespace" , this .nameSpace )
788788 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
789789 .connectTimeoutSeconds (config .getOpenTimeout ())
790790 .readTimeoutSeconds (config .getReadTimeout ())
@@ -869,7 +869,7 @@ public AuthResponse loginByGithub(final String githubToken, final String githubA
869869 final String requestJson = Json .object ().add ("token" , githubToken ).toString ();
870870 final RestResponse restResponse = new Rest ()//NOPMD
871871 .url (config .getAddress () + "/v1/auth/" + mount + "/login" )
872- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
872+ .header ("X-Vault-Namespace" , this .nameSpace )
873873 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
874874 .connectTimeoutSeconds (config .getOpenTimeout ())
875875 .readTimeoutSeconds (config .getReadTimeout ())
@@ -933,7 +933,7 @@ public AuthResponse loginByJwt(final String provider, final String role, final S
933933 final String requestJson = Json .object ().add ("role" , role ).add ("jwt" , jwt ).toString ();
934934 final RestResponse restResponse = new Rest ()
935935 .url (config .getAddress () + "/v1/auth/" + provider + "/login" )
936- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
936+ .header ("X-Vault-Namespace" , this .nameSpace )
937937 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
938938 .connectTimeoutSeconds (config .getOpenTimeout ())
939939 .readTimeoutSeconds (config .getReadTimeout ())
@@ -1073,7 +1073,7 @@ public AuthResponse loginByCert(final String certAuthMount) throws VaultExceptio
10731073 try {
10741074 final RestResponse restResponse = new Rest ()//NOPMD
10751075 .url (config .getAddress () + "/v1/auth/" + mount + "/login" )
1076- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
1076+ .header ("X-Vault-Namespace" , this .nameSpace )
10771077 .connectTimeoutSeconds (config .getOpenTimeout ())
10781078 .readTimeoutSeconds (config .getReadTimeout ())
10791079 .sslVerification (config .getSslConfig ().isVerify ())
@@ -1154,8 +1154,8 @@ public AuthResponse renewSelf(final long increment, final String tokenAuthMount)
11541154 final String requestJson = Json .object ().add ("increment" , increment ).toString ();
11551155 final RestResponse restResponse = new Rest ()//NOPMD
11561156 .url (config .getAddress () + "/v1/auth/" + mount + "/renew-self" )
1157- .optionalHeader ("X-Vault-Token" , config .getToken ())
1158- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
1157+ .header ("X-Vault-Token" , config .getToken ())
1158+ .header ("X-Vault-Namespace" , this .nameSpace )
11591159 .body (increment < 0 ? null : requestJson .getBytes (StandardCharsets .UTF_8 ))
11601160 .connectTimeoutSeconds (config .getOpenTimeout ())
11611161 .readTimeoutSeconds (config .getReadTimeout ())
@@ -1217,8 +1217,8 @@ public LookupResponse lookupSelf(final String tokenAuthMount) throws VaultExcept
12171217 // HTTP request to Vault
12181218 final RestResponse restResponse = new Rest ()//NOPMD
12191219 .url (config .getAddress () + "/v1/auth/" + mount + "/lookup-self" )
1220- .optionalHeader ("X-Vault-Token" , config .getToken ())
1221- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
1220+ .header ("X-Vault-Token" , config .getToken ())
1221+ .header ("X-Vault-Namespace" , this .nameSpace )
12221222 .connectTimeoutSeconds (config .getOpenTimeout ())
12231223 .readTimeoutSeconds (config .getReadTimeout ())
12241224 .sslVerification (config .getSslConfig ().isVerify ())
@@ -1279,8 +1279,8 @@ public LogicalResponse lookupWrap() throws VaultException {
12791279 // HTTP request to Vault
12801280 final RestResponse restResponse = new Rest ()//NOPMD
12811281 .url (config .getAddress () + "/v1/sys/wrapping/lookup" )
1282- .optionalHeader ("X-Vault-Token" , config .getToken ())
1283- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
1282+ .header ("X-Vault-Token" , config .getToken ())
1283+ .header ("X-Vault-Namespace" , this .nameSpace )
12841284 .connectTimeoutSeconds (config .getOpenTimeout ())
12851285 .readTimeoutSeconds (config .getReadTimeout ())
12861286 .sslVerification (config .getSslConfig ().isVerify ())
@@ -1341,8 +1341,8 @@ public void revokeSelf(final String tokenAuthMount) throws VaultException {
13411341 // HTTP request to Vault
13421342 final RestResponse restResponse = new Rest ()//NOPMD
13431343 .url (config .getAddress () + "/v1/auth/" + mount + "/revoke-self" )
1344- .optionalHeader ("X-Vault-Token" , config .getToken ())
1345- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
1344+ .header ("X-Vault-Token" , config .getToken ())
1345+ .header ("X-Vault-Namespace" , this .nameSpace )
13461346 .connectTimeoutSeconds (config .getOpenTimeout ())
13471347 .readTimeoutSeconds (config .getReadTimeout ())
13481348 .sslVerification (config .getSslConfig ().isVerify ())
@@ -1442,8 +1442,8 @@ public AuthResponse unwrap(final String wrappedToken) throws VaultException {
14421442 // HTTP request to Vault
14431443 final RestResponse restResponse = new Rest ()
14441444 .url (url )
1445- .optionalHeader ("X-Vault-Token" , config .getToken ())
1446- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
1445+ .header ("X-Vault-Token" , config .getToken ())
1446+ .header ("X-Vault-Namespace" , this .nameSpace )
14471447 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
14481448 .connectTimeoutSeconds (config .getOpenTimeout ())
14491449 .readTimeoutSeconds (config .getReadTimeout ())
0 commit comments