The connector supports reading and writing of access tokens as well as token roles.
While tokens basically are specialized secrets they have a well-documented API and several flags, s.t. they have been
abstracted for comfortable and speaking use.
Create, lookup and delete tokens
VaultConnectorconnector=...;// Create token using the builder (more flags available).Tokentoken=Token.builder().withId("my-token").withDisplayName("new test token").withType(Token.Type.SERVICE).withPolicies("pol1","pol2").build();// Write token to Vault.vault.createToken(token);// Lookup token by IDTokenResponsetokenRes=vault.lookupToken("my-token");
Handle token roles
// Create token role using the builder (more flags available).TokenRolerole=TokenRole.builder().forName("my-role").renewable(true).withTokenNumUses(42).build();// Create the role.vault.createOrUpdateTokenRole(role);// Read a token role.TokenRoleResponseroleRes=vault.readTokenRole("another-role");// List available roles.List<String>roles=vault.listTokenRoles();// Delete a token role.vault.deleteTokenRole("obsolete-rule");