Skip to content

Commit 4bd5334

Browse files
committed
make "role" input optional
Per Vault documentation it doesn't have to be provided, and the auth provider's "default_role" parameter is required precisely for this case. https://www.vaultproject.io/api/auth/jwt
1 parent 6728115 commit 4bd5334

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

integrationTests/basic/jwt_auth.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,15 @@ describe('jwt auth', () => {
233233
expect(core.exportVariable).toBeCalledWith('SECRET', 'SUPERSECRET');
234234
})
235235

236+
it('successfully authenticates as default role without specifying it', async () => {
237+
when(core.getInput)
238+
.calledWith('role')
239+
.mockReturnValueOnce(null);
240+
241+
await exportSecrets();
242+
expect(core.exportVariable).toBeCalledWith('SECRET', 'SUPERSECRET');
243+
})
244+
236245
});
237246

238247
});

src/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async function retrieveToken(method, client) {
2525
case 'jwt': {
2626
/** @type {string} */
2727
let jwt;
28-
const role = core.getInput('role', { required: true });
28+
const role = core.getInput('role', { required: false });
2929
const privateKeyRaw = core.getInput('jwtPrivateKey', { required: false });
3030
const privateKey = Buffer.from(privateKeyRaw, 'base64').toString();
3131
const keyPassword = core.getInput('jwtKeyPassword', { required: false });

0 commit comments

Comments
 (0)