-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path70_api_key_more.yml
72 lines (71 loc) · 1.68 KB
/
70_api_key_more.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
requires:
stack: true
serverless: false
---
setup:
- do:
security.put_role:
name: "api_key_grant_target_role"
body: >
{
"cluster": ["manage_token"],
"indices": [
{
"names": "index",
"privileges": ["all"]
}
]
}
- do:
security.put_user:
username: "api_key_grant_target_user"
body: >
{
"password" : "x-pack-test-password-2",
"roles" : [ "api_key_grant_target_role" ],
"full_name" : "API key grant target user"
}
---
teardown:
- do:
security.delete_role:
name: "api_key_grant_target_role"
ignore: 404
- do:
security.delete_user:
username: "api_key_grant_target_user"
ignore: 404
---
"Test grant api key with password":
- do:
security.grant_api_key:
body: >
{
"api_key": {
"name": "my-api-key",
"expiration": "1d",
"role_descriptors": {
"role": {
"index": [
{
"names": ["index"],
"privileges": ["read"]
}
]
}
}
},
"grant_type": "password",
"username": "api_key_grant_target_user",
"password": "x-pack-test-password-2"
}
- match: { name: "my-api-key" }
- is_true: id
- is_true: api_key
- is_true: expiration
- set: { id: api_key_id }
- do:
security.clear_api_key_cache:
ids: "$api_key_id"
- match: { _nodes.failed: 0 }