Skip to content

Commit

Permalink
try to fix private key auth test
Browse files Browse the repository at this point in the history
  • Loading branch information
fairclothjm committed Jul 31, 2024
1 parent 4228db3 commit bf290df
Showing 1 changed file with 34 additions and 17 deletions.
51 changes: 34 additions & 17 deletions integrationTests/basic/jwt_auth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,6 @@ describe('jwt auth', () => {
}
});

await got(`${vaultUrl}/v1/auth/jwt/role/default`, {
method: 'POST',
headers: {
'X-Vault-Token': vaultToken,
},
json: {
role_type: 'jwt',
bound_audiences: 'https://github.com/hashicorp/vault-action',
bound_claims: {
iss: 'vault-action'
},
user_claim: 'iss',
policies: ['reader']
}
});

await got(`${vaultUrl}/v1/secret/data/test`, {
method: 'POST',
headers: {
Expand All @@ -138,8 +122,25 @@ describe('jwt auth', () => {
});

describe('authenticate with private key', () => {
beforeAll(async () => {
await got(`${vaultUrl}/v1/auth/jwt/role/default`, {
method: 'POST',
headers: {
'X-Vault-Token': vaultToken,
},
json: {
role_type: 'jwt',
bound_audiences: null,
bound_claims: {
iss: 'vault-action'
},
user_claim: 'iss',
policies: ['reader']
}
});
});

beforeEach(() => {
jest.resetAllMocks();

when(core.getInput)
.calledWith('url', expect.anything())
Expand Down Expand Up @@ -170,6 +171,22 @@ describe('jwt auth', () => {

describe('authenticate with Github OIDC', () => {
beforeAll(async () => {
await got(`${vaultUrl}/v1/auth/jwt/role/default`, {
method: 'POST',
headers: {
'X-Vault-Token': vaultToken,
},
json: {
role_type: 'jwt',
bound_audiences: 'https://github.com/hashicorp/vault-action',
bound_claims: {
iss: 'vault-action'
},
user_claim: 'iss',
policies: ['reader']
}
});

await got(`${vaultUrl}/v1/auth/jwt/role/default-sigstore`, {
method: 'POST',
headers: {
Expand Down

0 comments on commit bf290df

Please sign in to comment.