use lookup-self for token check instead of lookup (#98) (#99)
All checks were successful
CI / build-with-it (11, 1.2.0) (push) Successful in 54s
CI / build-with-it (11, 1.19.0) (push) Successful in 1m0s
CI / build-with-it (17, 1.2.0) (push) Successful in 53s
CI / build-with-it (17, 1.19.0) (push) Successful in 58s
CI / build-with-it (21, 1.2.0) (push) Successful in 48s
CI / build-with-it (true, 21, 1.19.0) (push) Successful in 55s
All checks were successful
CI / build-with-it (11, 1.2.0) (push) Successful in 54s
CI / build-with-it (11, 1.19.0) (push) Successful in 1m0s
CI / build-with-it (17, 1.2.0) (push) Successful in 53s
CI / build-with-it (17, 1.19.0) (push) Successful in 58s
CI / build-with-it (21, 1.2.0) (push) Successful in 48s
CI / build-with-it (true, 21, 1.19.0) (push) Successful in 55s
Using the /lookup-self to retrieve information about the current token requires less permissions than the general /lookup API and yields the same results, if accessible.
This commit is contained in:
@ -54,6 +54,7 @@ public class HTTPVaultConnector implements VaultConnector {
|
||||
private static final String PATH_AUTH = "auth";
|
||||
private static final String PATH_AUTH_TOKEN = PATH_AUTH + "/token";
|
||||
private static final String PATH_LOOKUP = "/lookup";
|
||||
private static final String PATH_LOOKUP_SELF = "/lookup-self";
|
||||
private static final String PATH_CREATE = "/create";
|
||||
private static final String PATH_ROLES = "/roles";
|
||||
private static final String PATH_CREATE_ORPHAN = "/create-orphan";
|
||||
@ -191,7 +192,7 @@ public class HTTPVaultConnector implements VaultConnector {
|
||||
/* set token */
|
||||
this.token = token;
|
||||
this.tokenTTL = 0;
|
||||
TokenResponse res = request.post(PATH_AUTH_TOKEN + PATH_LOOKUP, emptyMap(), token, TokenResponse.class);
|
||||
TokenResponse res = request.get(PATH_AUTH_TOKEN + PATH_LOOKUP_SELF, emptyMap(), token, TokenResponse.class);
|
||||
authorized = true;
|
||||
|
||||
return res;
|
||||
|
Reference in New Issue
Block a user