mirror of
https://github.com/hashicorp/vault-action.git
synced 2025-11-07 15:16:56 +00:00
fix integration test jwt audience
This commit is contained in:
parent
3224a223d4
commit
c019897233
1 changed files with 37 additions and 17 deletions
|
|
@ -97,6 +97,8 @@ describe('jwt auth', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// write the jwt config, the jwt role will be written on a per-test
|
||||||
|
// basis since the audience may vary
|
||||||
await got(`${vaultUrl}/v1/auth/jwt/config`, {
|
await got(`${vaultUrl}/v1/auth/jwt/config`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -108,22 +110,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: null,
|
|
||||||
bound_claims: {
|
|
||||||
iss: 'vault-action'
|
|
||||||
},
|
|
||||||
user_claim: 'iss',
|
|
||||||
policies: ['reader']
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await got(`${vaultUrl}/v1/secret/data/test`, {
|
await got(`${vaultUrl}/v1/secret/data/test`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -138,6 +124,24 @@ describe('jwt auth', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('authenticate with private key', () => {
|
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(() => {
|
beforeEach(() => {
|
||||||
jest.resetAllMocks();
|
jest.resetAllMocks();
|
||||||
|
|
||||||
|
|
@ -170,6 +174,22 @@ describe('jwt auth', () => {
|
||||||
|
|
||||||
describe('authenticate with Github OIDC', () => {
|
describe('authenticate with Github OIDC', () => {
|
||||||
beforeAll(async () => {
|
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`, {
|
await got(`${vaultUrl}/v1/auth/jwt/role/default-sigstore`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -177,7 +197,7 @@ describe('jwt auth', () => {
|
||||||
},
|
},
|
||||||
json: {
|
json: {
|
||||||
role_type: 'jwt',
|
role_type: 'jwt',
|
||||||
bound_audiences: null,
|
bound_audiences: 'sigstore',
|
||||||
bound_claims: {
|
bound_claims: {
|
||||||
iss: 'vault-action',
|
iss: 'vault-action',
|
||||||
aud: 'sigstore',
|
aud: 'sigstore',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue