-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Password changes are only allowed when the user is currently authenticated by a realm (that permits the password to be changed) and not when authenticated by a bearer token or an API key.
- Loading branch information
Showing
3 changed files
with
123 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
x-pack/plugin/src/test/resources/rest-api-spec/test/change_password/11_token.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
setup: | ||
- skip: | ||
features: headers | ||
- do: | ||
cluster.health: | ||
wait_for_status: yellow | ||
- do: | ||
security.put_user: | ||
username: "token_joe" | ||
body: > | ||
{ | ||
"password": "s3krit", | ||
"roles" : [ "token_admin" ] | ||
} | ||
- do: | ||
security.put_role: | ||
name: "token_admin" | ||
body: > | ||
{ | ||
"cluster": ["manage_token"], | ||
"indices": [ | ||
{ | ||
"names": "*", | ||
"privileges": ["all"] | ||
} | ||
] | ||
} | ||
--- | ||
teardown: | ||
- do: | ||
security.delete_user: | ||
username: "token_joe" | ||
ignore: 404 | ||
- do: | ||
security.delete_role: | ||
name: "token_admin" | ||
ignore: 404 | ||
|
||
--- | ||
"Test user changing their password authenticating with token not allowed": | ||
|
||
- do: | ||
headers: | ||
Authorization: "Basic dG9rZW5fam9lOnMza3JpdA==" | ||
security.get_token: | ||
body: | ||
grant_type: "password" | ||
username: "token_joe" | ||
password: "s3krit" | ||
|
||
- match: { type: "Bearer" } | ||
- is_true: access_token | ||
- set: { access_token: token } | ||
- match: { expires_in: 1200 } | ||
- is_false: scope | ||
|
||
- do: | ||
headers: | ||
Authorization: Bearer ${token} | ||
catch: forbidden | ||
security.change_password: | ||
username: "joe" | ||
body: > | ||
{ | ||
"password" : "s3krit2" | ||
} |