@@ -261,8 +261,8 @@ public AuthResponse createToken(final TokenRequest tokenRequest, final String to
261261 // HTTP request to Vault
262262 final RestResponse restResponse = new Rest ()//NOPMD
263263 .url (url )
264- .optionalHeader ("X-Vault-Token" , config .getToken ())
265- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
264+ .header ("X-Vault-Token" , config .getToken ())
265+ .header ("X-Vault-Namespace" , this .nameSpace )
266266 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
267267 .connectTimeoutSeconds (config .getOpenTimeout ())
268268 .readTimeoutSeconds (config .getReadTimeout ())
@@ -422,7 +422,7 @@ public AuthResponse loginByAppRole(final String path, final String roleId, final
422422 final String requestJson = Json .object ().add ("role_id" , roleId ).add ("secret_id" , secretId ).toString ();
423423 final RestResponse restResponse = new Rest ()//NOPMD
424424 .url (config .getAddress () + "/v1/auth/" + path + "/login" )
425- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
425+ .header ("X-Vault-Namespace" , this .nameSpace )
426426 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
427427 .connectTimeoutSeconds (config .getOpenTimeout ())
428428 .readTimeoutSeconds (config .getReadTimeout ())
@@ -505,7 +505,7 @@ public AuthResponse loginByUserPass(final String username, final String password
505505 final String requestJson = Json .object ().add ("password" , password ).toString ();
506506 final RestResponse restResponse = new Rest ()//NOPMD
507507 .url (config .getAddress () + "/v1/auth/" + mount + "/login/" + username )
508- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
508+ .header ("X-Vault-Namespace" , this .nameSpace )
509509 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
510510 .connectTimeoutSeconds (config .getOpenTimeout ())
511511 .readTimeoutSeconds (config .getReadTimeout ())
@@ -628,7 +628,7 @@ public AuthResponse loginByAwsEc2(final String role, final String identity, fina
628628 final RestResponse restResponse = new Rest ()//NOPMD
629629 .url (config .getAddress () + "/v1/auth/" + mount + "/login" )
630630 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
631- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
631+ .header ("X-Vault-Namespace" , this .nameSpace )
632632 .connectTimeoutSeconds (config .getOpenTimeout ())
633633 .readTimeoutSeconds (config .getReadTimeout ())
634634 .sslVerification (config .getSslConfig ().isVerify ())
@@ -703,7 +703,7 @@ public AuthResponse loginByAwsEc2(final String role, final String pkcs7, final S
703703 final String requestJson = request .toString ();
704704 final RestResponse restResponse = new Rest ()//NOPMD
705705 .url (config .getAddress () + "/v1/auth/" + mount + "/login" )
706- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
706+ .header ("X-Vault-Namespace" , this .nameSpace )
707707 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
708708 .connectTimeoutSeconds (config .getOpenTimeout ())
709709 .readTimeoutSeconds (config .getReadTimeout ())
@@ -782,7 +782,7 @@ public AuthResponse loginByAwsIam(final String role, final String iamRequestUrl,
782782 final String requestJson = request .toString ();
783783 final RestResponse restResponse = new Rest ()//NOPMD
784784 .url (config .getAddress () + "/v1/auth/" + mount + "/login" )
785- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
785+ .header ("X-Vault-Namespace" , this .nameSpace )
786786 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
787787 .connectTimeoutSeconds (config .getOpenTimeout ())
788788 .readTimeoutSeconds (config .getReadTimeout ())
@@ -867,7 +867,7 @@ public AuthResponse loginByGithub(final String githubToken, final String githubA
867867 final String requestJson = Json .object ().add ("token" , githubToken ).toString ();
868868 final RestResponse restResponse = new Rest ()//NOPMD
869869 .url (config .getAddress () + "/v1/auth/" + mount + "/login" )
870- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
870+ .header ("X-Vault-Namespace" , this .nameSpace )
871871 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
872872 .connectTimeoutSeconds (config .getOpenTimeout ())
873873 .readTimeoutSeconds (config .getReadTimeout ())
@@ -931,7 +931,7 @@ public AuthResponse loginByJwt(final String provider, final String role, final S
931931 final String requestJson = Json .object ().add ("role" , role ).add ("jwt" , jwt ).toString ();
932932 final RestResponse restResponse = new Rest ()
933933 .url (config .getAddress () + "/v1/auth/" + provider + "/login" )
934- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
934+ .header ("X-Vault-Namespace" , this .nameSpace )
935935 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
936936 .connectTimeoutSeconds (config .getOpenTimeout ())
937937 .readTimeoutSeconds (config .getReadTimeout ())
@@ -1071,7 +1071,7 @@ public AuthResponse loginByCert(final String certAuthMount) throws VaultExceptio
10711071 try {
10721072 final RestResponse restResponse = new Rest ()//NOPMD
10731073 .url (config .getAddress () + "/v1/auth/" + mount + "/login" )
1074- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
1074+ .header ("X-Vault-Namespace" , this .nameSpace )
10751075 .connectTimeoutSeconds (config .getOpenTimeout ())
10761076 .readTimeoutSeconds (config .getReadTimeout ())
10771077 .sslVerification (config .getSslConfig ().isVerify ())
@@ -1152,8 +1152,8 @@ public AuthResponse renewSelf(final long increment, final String tokenAuthMount)
11521152 final String requestJson = Json .object ().add ("increment" , increment ).toString ();
11531153 final RestResponse restResponse = new Rest ()//NOPMD
11541154 .url (config .getAddress () + "/v1/auth/" + mount + "/renew-self" )
1155- .optionalHeader ("X-Vault-Token" , config .getToken ())
1156- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
1155+ .header ("X-Vault-Token" , config .getToken ())
1156+ .header ("X-Vault-Namespace" , this .nameSpace )
11571157 .body (increment < 0 ? null : requestJson .getBytes (StandardCharsets .UTF_8 ))
11581158 .connectTimeoutSeconds (config .getOpenTimeout ())
11591159 .readTimeoutSeconds (config .getReadTimeout ())
@@ -1215,8 +1215,8 @@ public LookupResponse lookupSelf(final String tokenAuthMount) throws VaultExcept
12151215 // HTTP request to Vault
12161216 final RestResponse restResponse = new Rest ()//NOPMD
12171217 .url (config .getAddress () + "/v1/auth/" + mount + "/lookup-self" )
1218- .optionalHeader ("X-Vault-Token" , config .getToken ())
1219- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
1218+ .header ("X-Vault-Token" , config .getToken ())
1219+ .header ("X-Vault-Namespace" , this .nameSpace )
12201220 .connectTimeoutSeconds (config .getOpenTimeout ())
12211221 .readTimeoutSeconds (config .getReadTimeout ())
12221222 .sslVerification (config .getSslConfig ().isVerify ())
@@ -1277,8 +1277,8 @@ public LogicalResponse lookupWrap() throws VaultException {
12771277 // HTTP request to Vault
12781278 final RestResponse restResponse = new Rest ()//NOPMD
12791279 .url (config .getAddress () + "/v1/sys/wrapping/lookup" )
1280- .optionalHeader ("X-Vault-Token" , config .getToken ())
1281- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
1280+ .header ("X-Vault-Token" , config .getToken ())
1281+ .header ("X-Vault-Namespace" , this .nameSpace )
12821282 .connectTimeoutSeconds (config .getOpenTimeout ())
12831283 .readTimeoutSeconds (config .getReadTimeout ())
12841284 .sslVerification (config .getSslConfig ().isVerify ())
@@ -1339,8 +1339,8 @@ public void revokeSelf(final String tokenAuthMount) throws VaultException {
13391339 // HTTP request to Vault
13401340 final RestResponse restResponse = new Rest ()//NOPMD
13411341 .url (config .getAddress () + "/v1/auth/" + mount + "/revoke-self" )
1342- .optionalHeader ("X-Vault-Token" , config .getToken ())
1343- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
1342+ .header ("X-Vault-Token" , config .getToken ())
1343+ .header ("X-Vault-Namespace" , this .nameSpace )
13441344 .connectTimeoutSeconds (config .getOpenTimeout ())
13451345 .readTimeoutSeconds (config .getReadTimeout ())
13461346 .sslVerification (config .getSslConfig ().isVerify ())
@@ -1440,8 +1440,8 @@ public AuthResponse unwrap(final String wrappedToken) throws VaultException {
14401440 // HTTP request to Vault
14411441 final RestResponse restResponse = new Rest ()
14421442 .url (url )
1443- .optionalHeader ("X-Vault-Token" , config .getToken ())
1444- .optionalHeader ("X-Vault-Namespace" , this .nameSpace )
1443+ .header ("X-Vault-Token" , config .getToken ())
1444+ .header ("X-Vault-Namespace" , this .nameSpace )
14451445 .body (requestJson .getBytes (StandardCharsets .UTF_8 ))
14461446 .connectTimeoutSeconds (config .getOpenTimeout ())
14471447 .readTimeoutSeconds (config .getReadTimeout ())
0 commit comments