Skip to content

Commit

Permalink
adding new specs for security endpoints without _xpack prefix (#27057) (
Browse files Browse the repository at this point in the history
#27391)

* adding new specs for security endpoints without _xpack prefix

* adding overrides

* fixing issues with autocomplete and missing docs
  • Loading branch information
bmcconaghy committed Dec 18, 2018
1 parent d7a0283 commit 319cc41
Show file tree
Hide file tree
Showing 34 changed files with 491 additions and 1 deletion.
Expand Up @@ -32,3 +32,4 @@ export { FieldAutocompleteComponent } from './field_autocomplete_component';
export { TypeAutocompleteComponent } from './type_autocomplete_component';
export { IdAutocompleteComponent } from './id_autocomplete_component';
export { TemplateAutocompleteComponent } from './template_autocomplete_component';
export { UsernameAutocompleteComponent } from './username_autocomplete_component';
@@ -0,0 +1,43 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import _ from 'lodash';
import mappings from '../../mappings';
import { ListComponent } from './list_component';
function nonValidUsernameType(token) {
return token[0] === '_';
}
export class UsernameAutocompleteComponent extends ListComponent {
constructor(name, parent, multiValued) {
super(name, mappings.getIndices, parent, multiValued);
}
validateTokens(tokens) {
if (!this.multiValued && tokens.length > 1) {
return false;
}
return !_.find(tokens, nonValidUsernameType);
}

getDefaultTermMeta() {
return 'username';
}

getContextKey() {
return 'username';
}
}
9 changes: 8 additions & 1 deletion src/legacy/core_plugins/console/public/src/kb.js
Expand Up @@ -22,7 +22,8 @@ import {
IndexAutocompleteComponent,
FieldAutocompleteComponent,
ListComponent,
TemplateAutocompleteComponent
TemplateAutocompleteComponent,
UsernameAutocompleteComponent
} from './autocomplete/components';

import $ from 'jquery';
Expand Down Expand Up @@ -61,6 +62,12 @@ const parametrizedComponentFactories = {
id: function (name, parent) {
return idAutocompleteComponentFactory(name, parent);
},
username: function (name, parent) {
return new UsernameAutocompleteComponent(name, parent);
},
user: function (name, parent) {
return new UsernameAutocompleteComponent(name, parent);
},
template: function (name, parent) {
return new TemplateAutocompleteComponent(name, parent);
},
Expand Down
@@ -0,0 +1,11 @@
{
"security.authenticate": {
"methods": [
"GET"
],
"patterns": [
"_security/_authenticate"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html"
}
}
@@ -0,0 +1,20 @@
{
"security.change_password": {
"url_params": {
"refresh": [
"true",
"false",
"wait_for"
]
},
"methods": [
"PUT",
"POST"
],
"patterns": [
"_security/user/{username}/_password",
"_security/user/_password"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html"
}
}
@@ -0,0 +1,14 @@
{
"security.clear_cached_realms": {
"url_params": {
"usernames": []
},
"methods": [
"POST"
],
"patterns": [
"_security/realm/{realms}/_clear_cache"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html"
}
}
@@ -0,0 +1,11 @@
{
"security.clear_cached_roles": {
"methods": [
"POST"
],
"patterns": [
"_security/role/{name}/_clear_cache"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-role-cache.html"
}
}
@@ -0,0 +1,18 @@
{
"security.delete_privileges": {
"url_params": {
"refresh": [
"true",
"false",
"wait_for"
]
},
"methods": [
"DELETE"
],
"patterns": [
"_security/privilege/{application}/{name}"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delete-privilege.html"
}
}
@@ -0,0 +1,18 @@
{
"security.delete_role": {
"url_params": {
"refresh": [
"true",
"false",
"wait_for"
]
},
"methods": [
"DELETE"
],
"patterns": [
"_security/role/{name}"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role.html"
}
}
@@ -0,0 +1,18 @@
{
"security.delete_role_mapping": {
"url_params": {
"refresh": [
"true",
"false",
"wait_for"
]
},
"methods": [
"DELETE"
],
"patterns": [
"_security/role_mapping/{name}"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role-mapping.html"
}
}
@@ -0,0 +1,18 @@
{
"security.delete_user": {
"url_params": {
"refresh": [
"true",
"false",
"wait_for"
]
},
"methods": [
"DELETE"
],
"patterns": [
"_security/user/{username}"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-user.html"
}
}
@@ -0,0 +1,19 @@
{
"security.disable_user": {
"url_params": {
"refresh": [
"true",
"false",
"wait_for"
]
},
"methods": [
"PUT",
"POST"
],
"patterns": [
"_security/user/{username}/_disable"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user.html"
}
}
@@ -0,0 +1,19 @@
{
"security.enable_user": {
"url_params": {
"refresh": [
"true",
"false",
"wait_for"
]
},
"methods": [
"PUT",
"POST"
],
"patterns": [
"_security/user/{username}/_enable"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-enable-user.html"
}
}
@@ -0,0 +1,11 @@
{
"security.get_privileges": {
"methods": [
"GET"
],
"patterns": [
"_security/privilege/{application}/{name}"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-privileges.html"
}
}
@@ -0,0 +1,12 @@
{
"security.get_role": {
"methods": [
"GET"
],
"patterns": [
"_security/role/{name}",
"_security/role"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html"
}
}
@@ -0,0 +1,12 @@
{
"security.get_role_mapping": {
"methods": [
"GET"
],
"patterns": [
"_security/role_mapping/{name}",
"_security/role_mapping"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role-mapping.html"
}
}
@@ -0,0 +1,11 @@
{
"security.get_token": {
"methods": [
"POST"
],
"patterns": [
"_security/oauth2/token"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html"
}
}
@@ -0,0 +1,12 @@
{
"security.get_user": {
"methods": [
"GET"
],
"patterns": [
"_security/user/{username}",
"_security/user"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html"
}
}
@@ -0,0 +1,10 @@
{
"security.get_user_privileges": {
"methods": [
"GET"
],
"patterns": [
"_security/user/_privileges"
]
}
}
@@ -0,0 +1,13 @@
{
"security.has_privileges": {
"methods": [
"GET",
"POST"
],
"patterns": [
"_security/user/_has_privileges",
"_security/user/{user}/_has_privileges"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges.html"
}
}
@@ -0,0 +1,11 @@
{
"security.invalidate_token": {
"methods": [
"DELETE"
],
"patterns": [
"_security/oauth2/token"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-token.html"
}
}
@@ -0,0 +1,19 @@
{
"security.put_privileges": {
"url_params": {
"refresh": [
"true",
"false",
"wait_for"
]
},
"methods": [
"PUT",
"POST"
],
"patterns": [
"_security/privilege/"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-put-privileges.html"
}
}
@@ -0,0 +1,19 @@
{
"security.put_role": {
"url_params": {
"refresh": [
"true",
"false",
"wait_for"
]
},
"methods": [
"PUT",
"POST"
],
"patterns": [
"_security/role/{name}"
],
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html"
}
}

0 comments on commit 319cc41

Please sign in to comment.