Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last nit-picks, I promise #21

Merged
merged 2 commits into from
Oct 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/security/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export const GLOBAL_RESOURCE = '*';
export const IGNORED_TYPES = ['space'];
export const APPLICATION_PREFIX = 'kibana-';
export const RESERVED_PRIVILEGES_APPLICATION_WILDCARD = 'kibana-*';
export const API_BASE_PATH = '/internal/security';
export const INTERNAL_API_BASE_PATH = '/internal/security';
4 changes: 2 additions & 2 deletions x-pack/legacy/plugins/security/public/lib/api_keys_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { kfetch } from 'ui/kfetch';
import { ApiKey, ApiKeyToInvalidate } from '../../common/model/api_key';
import { API_BASE_PATH } from '../../common/constants';
import { INTERNAL_API_BASE_PATH } from '../../common/constants';

interface CheckPrivilegesResponse {
areApiKeysEnabled: boolean;
Expand All @@ -22,7 +22,7 @@ interface GetApiKeysResponse {
apiKeys: ApiKey[];
}

const apiKeysUrl = `${API_BASE_PATH}/api_key`;
const apiKeysUrl = `${INTERNAL_API_BASE_PATH}/api_key`;

export class ApiKeysApi {
public static async checkPrivileges(): Promise<CheckPrivilegesResponse> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

import Joi from 'joi';
import { wrapError } from '../../../../../../../../plugins/security/server';
import { API_BASE_PATH } from '../../../../../common/constants';
import { INTERNAL_API_BASE_PATH } from '../../../../../common/constants';

export function initGetApiKeysApi(server, callWithRequest, routePreCheckLicenseFn) {
server.route({
method: 'GET',
path: `${API_BASE_PATH}/api_key`,
path: `${INTERNAL_API_BASE_PATH}/api_key`,
async handler(request) {
try {
const { isAdmin } = request.query;
Expand All @@ -37,8 +37,8 @@ export function initGetApiKeysApi(server, callWithRequest, routePreCheckLicenseF
pre: [routePreCheckLicenseFn],
validate: {
query: Joi.object().keys({
isAdmin: Joi.bool(),
}),
isAdmin: Joi.bool().required(),
}).required(),
},
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

import Joi from 'joi';
import { wrapError } from '../../../../../../../../plugins/security/server';
import { API_BASE_PATH } from '../../../../../common/constants';
import { INTERNAL_API_BASE_PATH } from '../../../../../common/constants';

export function initInvalidateApiKeysApi(server, callWithRequest, routePreCheckLicenseFn) {
server.route({
method: 'POST',
path: `${API_BASE_PATH}/api_key/invalidate`,
path: `${INTERNAL_API_BASE_PATH}/api_key/invalidate`,
async handler(request) {
try {
const { apiKeys, isAdmin } = request.payload;
Expand Down Expand Up @@ -62,7 +62,7 @@ export function initInvalidateApiKeysApi(server, callWithRequest, routePreCheckL
id: Joi.string().required(),
name: Joi.string().required(),
})).required(),
isAdmin: Joi.bool(),
isAdmin: Joi.bool().required(),
})
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
*/

import { wrapError } from '../../../../../../../../plugins/security/server';
import { API_BASE_PATH } from '../../../../../common/constants';
import { INTERNAL_API_BASE_PATH } from '../../../../../common/constants';

export function initCheckPrivilegesApi(server, callWithRequest, routePreCheckLicenseFn) {
server.route({
method: 'GET',
path: `${API_BASE_PATH}/api_key/privileges`,
path: `${INTERNAL_API_BASE_PATH}/api_key/privileges`,
async handler(request) {
try {
const result = await Promise.all([
Expand Down