15
15
*/
16
16
package org .springframework .vault .authentication ;
17
17
18
+ import static org .springframework .vault .authentication .AuthenticationSteps .HttpRequestBuilder .*;
19
+ import static org .springframework .vault .authentication .AuthenticationUtil .*;
20
+
18
21
import java .util .HashMap ;
19
22
import java .util .Map ;
20
23
43
46
import org .springframework .web .client .RestClientException ;
44
47
import org .springframework .web .client .RestOperations ;
45
48
46
- import static org .springframework .vault .authentication .AuthenticationSteps .HttpRequestBuilder .*;
47
- import static org .springframework .vault .authentication .AuthenticationUtil .*;
48
-
49
49
/**
50
50
* AppRole implementation of {@link ClientAuthentication}. RoleId and SecretId (optional)
51
51
* are sent in the login request to Vault to obtain a {@link VaultToken}.
@@ -217,8 +217,8 @@ private String getRoleId(RoleId roleId) throws VaultLoginException {
217
217
return (String ) entity .getBody ().getRequiredData ().get ("role_id" );
218
218
}
219
219
catch (HttpStatusCodeException e ) {
220
- throw new VaultLoginException (String . format ( "Cannot get Role id using AppRole: %s" ,
221
- VaultResponses .getError (e .getResponseBodyAsString ())), e );
220
+ throw new VaultLoginException ("Cannot get Role id using AppRole: %s"
221
+ . formatted ( VaultResponses .getError (e .getResponseBodyAsString ())), e );
222
222
}
223
223
}
224
224
@@ -236,8 +236,8 @@ private String getRoleId(RoleId roleId) throws VaultLoginException {
236
236
return (String ) response .getRequiredData ().get ("role_id" );
237
237
}
238
238
catch (HttpStatusCodeException e ) {
239
- throw new VaultLoginException (String . format ( "Cannot unwrap Role id using AppRole: %s" ,
240
- VaultResponses .getError (e .getResponseBodyAsString ())), e );
239
+ throw new VaultLoginException ("Cannot unwrap Role id using AppRole: %s"
240
+ . formatted ( VaultResponses .getError (e .getResponseBodyAsString ())), e );
241
241
}
242
242
}
243
243
@@ -260,8 +260,8 @@ private String getSecretId(SecretId secretId) throws VaultLoginException {
260
260
return (String ) response .getRequiredData ().get ("secret_id" );
261
261
}
262
262
catch (HttpStatusCodeException e ) {
263
- throw new VaultLoginException (String . format ( "Cannot get Secret id using AppRole: %s" ,
264
- VaultResponses .getError (e .getResponseBodyAsString ())), e );
263
+ throw new VaultLoginException ("Cannot get Secret id using AppRole: %s"
264
+ . formatted ( VaultResponses .getError (e .getResponseBodyAsString ())), e );
265
265
}
266
266
}
267
267
@@ -280,8 +280,8 @@ private String getSecretId(SecretId secretId) throws VaultLoginException {
280
280
return (String ) response .getRequiredData ().get ("secret_id" );
281
281
}
282
282
catch (HttpStatusCodeException e ) {
283
- throw new VaultLoginException (String . format ( "Cannot unwrap Role id using AppRole: %s" ,
284
- VaultResponses .getError (e .getResponseBodyAsString ())), e );
283
+ throw new VaultLoginException ("Cannot unwrap Role id using AppRole: %s"
284
+ . formatted ( VaultResponses .getError (e .getResponseBodyAsString ())), e );
285
285
}
286
286
}
287
287
@@ -331,11 +331,11 @@ private static Map<String, String> getAppRoleLoginBody(String roleId, @Nullable
331
331
}
332
332
333
333
private static String getSecretIdPath (AppRoleAuthenticationOptions options ) {
334
- return String . format ( "auth/%s/role/%s/secret-id" , options .getPath (), options .getAppRole ());
334
+ return "auth/%s/role/%s/secret-id" . formatted ( options .getPath (), options .getAppRole ());
335
335
}
336
336
337
337
private static String getRoleIdIdPath (AppRoleAuthenticationOptions options ) {
338
- return String . format ( "auth/%s/role/%s/role-id" , options .getPath (), options .getAppRole ());
338
+ return "auth/%s/role/%s/role-id" . formatted ( options .getPath (), options .getAppRole ());
339
339
}
340
340
341
341
}
0 commit comments