Merge "Rename the package to monasca-kibana-plugin"

This commit is contained in:
Jenkins 2017-02-13 11:51:23 +00:00 committed by Gerrit Code Review
commit 85eaa51a10
20 changed files with 55 additions and 52 deletions

View File

@ -1,7 +1,16 @@
FTS-Keystone Monasca Kibana plugin
===== =====
Keystone authentication support for Kibana 4.4.x Keystone authentication support and multi-tenancy for Kibana 4.6.x
Build
-----
```
npm install
npm run package
```
Installation Installation
----- -----
@ -10,24 +19,18 @@ Requires a working version of Kibana. The kibana configuration file (/opt/kibana
where keystone_port should be the keystone admin port (default: 35357) not the keystone member port (default: 5000): where keystone_port should be the keystone admin port (default: 35357) not the keystone member port (default: 5000):
``` ```
fts-keystone.port: ${keystone_port} monasca-kibana-plugin.port: ${keystone_port}
fts-keystone.url: http://${keystone_host} monasca-kibana-plugin.url: http://${keystone_host}
fts-keystone.enabled: True monasca-kibana-plugin.enabled: True
fts-keystone.defaultTimeField: '@timestamp' monasca-kibana-plugin.defaultTimeField: '@timestamp'
``` ```
To install the fts-keystone plugin, first the latest release should be downloaded: Then install using the Kibana plugin manager tool:
``` ```
$ (cd /tmp; wget https://github.com/FujitsuEnablingSoftwareTechnologyGmbH/fts-keystone/releases/download/v0.0.1/fts-keystone-0.0.1.tar.gz; cd -) $ /opt/kibana/bin/kibana plugin --install monasca-kibana-plugin --url file:///tmp/monasca-kibana-plugin-0.0.1.tar.gz
``` Installing monasca-kibana-plugin
Attempting to transfer from file:///tmp/monasca-kibana-plugin-0.0.1.tar.gz
Then installed using the Kibana plugin manager tool:
```
$ /opt/kibana/bin/kibana plugin --install fts-keystone --url file:///tmp/fts-keystone-0.0.1.tar.gz
Installing fts-keystone
Attempting to transfer from file:///tmp/fts-keystone-0.0.1.tar.gz
Transferring 7567007 bytes.................... Transferring 7567007 bytes....................
Transfer complete Transfer complete
Extracting plugin archive Extracting plugin archive
@ -36,7 +39,7 @@ Optimizing and caching browser bundles...
Plugin installation complete Plugin installation complete
$ /opt/kibana/bin/kibana plugin --list $ /opt/kibana/bin/kibana plugin --list
fts-keystone monasca-kibana-plugin
``` ```
Now start/restart your Kibana server by running: Now start/restart your Kibana server by running:

View File

@ -1,8 +1,8 @@
{ {
"name": "fts-keystone", "name": "monasca-kibana-plugin",
"version": "0.0.5", "version": "0.0.5",
"description": "Keystone authentication & multitenancy support for Kibana 4.5.x", "description": "Keystone authentication & multitenancy support for Kibana 4.6.x",
"author": "Fujitsu Enabling Software Technology GmbH", "author": "OpenStack",
"license": "Apache-2.0", "license": "Apache-2.0",
"keywords": [ "keywords": [
"kibana", "kibana",
@ -29,7 +29,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "http://github.com/FujitsuEnablingSoftwareTechnologyGmbH/fts-keystone.git" "url": "https://github.com/openstack/monasca-kibana-plugin.git"
}, },
"devDependencies": { "devDependencies": {
"babel-eslint": "^4.1.8", "babel-eslint": "^4.1.8",

View File

@ -16,7 +16,7 @@ const sinon = require('sinon');
const chai = require('chai'); const chai = require('chai');
const proxyRequire = require('proxyquire'); const proxyRequire = require('proxyquire');
describe('fts-keystone', () => { describe('monasca-kibana-plugin', () => {
describe('binding', () => { describe('binding', () => {
it('should expose tokens & users', () => { it('should expose tokens & users', () => {

View File

@ -16,7 +16,7 @@
const chai = require('chai'); const chai = require('chai');
const sinon = require('sinon'); const sinon = require('sinon');
describe('plugins/fts-keystone', () => { describe('plugins/monasca-kibana-plugin', () => {
const indexName = '.kibana-testdefaultindex'; const indexName = '.kibana-testdefaultindex';
let server; let server;
let userObj; let userObj;
@ -26,7 +26,7 @@ describe('plugins/fts-keystone', () => {
beforeEach(function () { beforeEach(function () {
configGet = sinon.stub(); configGet = sinon.stub();
configGet.withArgs('pkg.version').returns('4.4.0'); configGet.withArgs('pkg.version').returns('4.4.0');
configGet.withArgs('fts-keystone.defaultTimeField').returns('@timestamp'); configGet.withArgs('monasca-kibana-plugin.defaultTimeField').returns('@timestamp');
server = { server = {
log : sinon.stub(), log : sinon.stub(),

View File

@ -16,7 +16,7 @@ const sinon = require('sinon');
const chai = require('chai'); const chai = require('chai');
const proxyRequire = require('proxyquire'); const proxyRequire = require('proxyquire');
describe('plugins/fts-keystone', ()=> { describe('plugins/monasca-kibana-plugin', ()=> {
describe('healthcheck', ()=> { describe('healthcheck', ()=> {
const keystoneUrl = 'http://localhost'; // mocking http const keystoneUrl = 'http://localhost'; // mocking http
@ -38,7 +38,7 @@ describe('plugins/fts-keystone', ()=> {
beforeEach(function () { beforeEach(function () {
plugin = { plugin = {
name : 'fts-keystone', name : 'monasca-kibana-plugin',
status: { status: {
red : sinon.stub(), red : sinon.stub(),
green : sinon.stub(), green : sinon.stub(),
@ -47,8 +47,8 @@ describe('plugins/fts-keystone', ()=> {
}; };
configGet = sinon.stub(); configGet = sinon.stub();
configGet.withArgs('fts-keystone.url').returns(keystoneUrl); configGet.withArgs('monasca-kibana-plugin.url').returns(keystoneUrl);
configGet.withArgs('fts-keystone.port').returns(keystonePort); configGet.withArgs('monasca-kibana-plugin.port').returns(keystonePort);
server = { server = {
log : sinon.stub(), log : sinon.stub(),

View File

@ -19,7 +19,7 @@ const retrieveToken = require('../mt/auth/token');
const CONSTANTS = require('../const'); const CONSTANTS = require('../const');
const RELOAD_SYMBOL = require('../mt/auth/reload'); const RELOAD_SYMBOL = require('../mt/auth/reload');
describe('plugins/fts-keystone', ()=> { describe('plugins/monasca-kibana-plugin', ()=> {
describe('mt', ()=> { describe('mt', ()=> {
describe('auth', () => { describe('auth', () => {
describe('token', ()=> { describe('token', ()=> {
@ -28,7 +28,7 @@ describe('plugins/fts-keystone', ()=> {
beforeEach(()=> { beforeEach(()=> {
let configGet = sinon.stub(); let configGet = sinon.stub();
configGet.withArgs('fts-keystone.cookie.name').returns('keystone'); configGet.withArgs('monasca-kibana-plugin.cookie.name').returns('keystone');
server = { server = {
log: sinon.stub(), log: sinon.stub(),
config: function () { config: function () {

View File

@ -16,7 +16,7 @@ const sinon = require('sinon');
const chai = require('chai'); const chai = require('chai');
const proxyRequire = require('proxyquire'); const proxyRequire = require('proxyquire');
describe('plugins/fts-keystone', () => { describe('plugins/monasca-kibana-plugin', () => {
describe('mt', () => { describe('mt', () => {
describe('routing', () => { describe('routing', () => {
describe('createProxy', () => { describe('createProxy', () => {

View File

@ -16,7 +16,7 @@ const sinon = require('sinon');
const chai = require('chai'); const chai = require('chai');
const proxyRequire = require('proxyquire'); const proxyRequire = require('proxyquire');
describe('plugins/fts-keystone', () => { describe('plugins/monasca-kibana-plugin', () => {
describe('mt', () => { describe('mt', () => {
describe('routing', () => { describe('routing', () => {
describe('reRoute', () => { describe('reRoute', () => {

View File

@ -16,7 +16,7 @@ const sinon = require('sinon');
const chai = require('chai'); const chai = require('chai');
const proxyRequire = require('proxyquire'); const proxyRequire = require('proxyquire');
describe('plugins/fts-keystone', ()=> { describe('plugins/monasca-kibana-plugin', ()=> {
describe('mt', ()=> { describe('mt', ()=> {
describe('routing', () => { describe('routing', () => {

View File

@ -15,7 +15,7 @@
const chai = require('chai'); const chai = require('chai');
const util = require('../util'); const util = require('../util');
describe('plugins/fts-keystone', ()=> { describe('plugins/monasca-kibana-plugin', ()=> {
describe('util', ()=> { describe('util', ()=> {
const CHECK_STR = 'test.str'; const CHECK_STR = 'test.str';

View File

@ -18,7 +18,7 @@ const proxyRequire = require('proxyquire');
const CONSTANTS = require('../const'); const CONSTANTS = require('../const');
describe('plugins/fts-keystone', ()=> { describe('plugins/monasca-kibana-plugin', ()=> {
describe('mt', ()=> { describe('mt', ()=> {
describe('verify', () => { describe('verify', () => {

View File

@ -18,7 +18,7 @@ const chai = require('chai');
const CONSTANTS = require('../const'); const CONSTANTS = require('../const');
const verifyIndexPattern = require('../mt/verify/_verify_index_pattern'); const verifyIndexPattern = require('../mt/verify/_verify_index_pattern');
describe('plugins/fts-keystone', ()=> { describe('plugins/monasca-kibana-plugin', ()=> {
describe('mt', ()=> { describe('mt', ()=> {
describe('verify', () => { describe('verify', () => {
describe('verify_index_pattern', () => { describe('verify_index_pattern', () => {

View File

@ -18,7 +18,7 @@ import UsersApi from 'keystone-v3-client/lib/keystone/users';
module.exports = function binding(server) { module.exports = function binding(server) {
const config = server.config(); const config = server.config();
const keystoneCfg = { const keystoneCfg = {
url: `${config.get('fts-keystone.url')}:${config.get('fts-keystone.port')}` url: `${config.get('monasca-kibana-plugin.url')}:${config.get('monasca-kibana-plugin.port')}`
}; };
return { return {

View File

@ -14,10 +14,10 @@
const NOW_TIME = (new Date().valueOf() / 1000); const NOW_TIME = (new Date().valueOf() / 1000);
export const SESSION_USER_KEY = `fts-keystone-user-${NOW_TIME}`; export const SESSION_USER_KEY = `monasca-kibana-plugin-user-${NOW_TIME}`;
export const SESSION_TOKEN_KEY = `fts-keystone-token-${NOW_TIME}`; export const SESSION_TOKEN_KEY = `monasca-kibana-plugin-token-${NOW_TIME}`;
export const SESSION_PROJECTS_KEY = `fts-keystone-projects-${NOW_TIME}`; export const SESSION_PROJECTS_KEY = `monasca-kibana-plugin-projects-${NOW_TIME}`;
export const SESSION_TOKEN_CHANGED = `fts-keystone-token-changed-${NOW_TIME}`; export const SESSION_TOKEN_CHANGED = `monasca-kibana-plugin-token-changed-${NOW_TIME}`;
export const TOKEN_CHANGED_VALUE = Symbol('token-changed'); export const TOKEN_CHANGED_VALUE = Symbol('token-changed');

View File

@ -19,8 +19,8 @@ import util from '../util';
module.exports = function healthcheck(plugin, server) { module.exports = function healthcheck(plugin, server) {
const config = server.config(); const config = server.config();
const keystoneUrl = config.get('fts-keystone.url'); const keystoneUrl = config.get('monasca-kibana-plugin.url');
const keystonePort = config.get('fts-keystone.port'); const keystonePort = config.get('monasca-kibana-plugin.port');
const request = getRequest(); const request = getRequest();
let timeoutId; let timeoutId;

View File

@ -29,7 +29,7 @@ const SCHEMA = {
export default (server, opts) => { export default (server, opts) => {
Joi.assert(opts, SCHEMA, 'Invalid keystone auth options'); Joi.assert(opts, SCHEMA, 'Invalid keystone auth options');
const tokensApi = server.plugins['fts-keystone'].tokens; const tokensApi = server.plugins['monasca-kibana-plugin'].tokens;
const callbackOk = opts.tokenOk; const callbackOk = opts.tokenOk;
const callbackBad = opts.tokenBad; const callbackBad = opts.tokenBad;

View File

@ -46,7 +46,7 @@ module.exports = (server, request) => {
// this is a workaround for problem with 'default' session: // this is a workaround for problem with 'default' session:
// when there is no session cookie present, then yar uses default session, // when there is no session cookie present, then yar uses default session,
// as a result many clients use the same session - security risk! // as a result many clients use the same session - security risk!
const cookieName = server.config().get('fts-keystone.cookie.name'); const cookieName = server.config().get('monasca-kibana-plugin.cookie.name');
if (!request.state[cookieName]) { if (!request.state[cookieName]) {
request.yar.reset(); request.yar.reset();
} }

View File

@ -25,7 +25,7 @@ export default (server, indexName, userObj) => {
type : 'index-pattern', type : 'index-pattern',
body : { body : {
title: pattern, title: pattern,
timeFieldName : server.config().get('fts-keystone.defaultTimeField') timeFieldName : server.config().get('monasca-kibana-plugin.defaultTimeField')
}, },
id : pattern id : pattern
}) })

View File

@ -19,7 +19,7 @@ import { SESSION_PROJECTS_KEY, SESSION_TOKEN_KEY } from '../../const';
export default (server, session, userObj) => { export default (server, session, userObj) => {
const usersApi = server.plugins['fts-keystone'].users; const usersApi = server.plugins['monasca-kibana-plugin'].users;
return new Promise((resolve) => { return new Promise((resolve) => {
return usersApi return usersApi

View File

@ -23,15 +23,15 @@ export default (server) => {
register: yarCookie, register: yarCookie,
options : { options : {
maxCookieSize: 4096, maxCookieSize: 4096,
name : config.get('fts-keystone.cookie.name'), name : config.get('monasca-kibana-plugin.cookie.name'),
storeBlank : false, storeBlank : false,
cache : { cache : {
expiresIn: config.get('fts-keystone.cookie.expiresIn') expiresIn: config.get('monasca-kibana-plugin.cookie.expiresIn')
}, },
cookieOptions: { cookieOptions: {
password : config.get('fts-keystone.cookie.password'), password : config.get('monasca-kibana-plugin.cookie.password'),
isSecure : config.get('fts-keystone.cookie.isSecure'), isSecure : config.get('monasca-kibana-plugin.cookie.isSecure'),
ignoreErrors: config.get('fts-keystone.cookie.ignoreErrors'), ignoreErrors: config.get('monasca-kibana-plugin.cookie.ignoreErrors'),
clearInvalid: false clearInvalid: false
} }
} }