Skip to content

Commit

Permalink
v1.0.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
kadishmal committed Apr 15, 2016
0 parents commit 636ffe0
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
node_modules
.idea
*.log
build
34 changes: 34 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = function (grunt) {
const package = require('./package.json');

var deps = Object.keys(package.dependencies || {});

var files = [
`${package.name}.js`,
'LICENSE',
'package.json',
'README.md',
];

deps.forEach(function (dep) {
files.push(`node_modules/${dep}/**/*`);
});

grunt.initConfig({
compress: {
build: {
options: {
archive: `build/${package.name}-${package.version}.zip`
},
src: files,
// The directory name within the archive.
dest: package.name
}
}
});

grunt.loadNpmTasks('grunt-contrib-compress');

grunt.registerTask('build', ['compress']);
grunt.registerTask('default', ['build']);
};
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Esen Sagynov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# kibana-express-session

A Kibana plugin to check if a user is authenticated. Uses `express-session-hapi` module
to check for session data in Redis.

## Usage

./bin/kibana plugin -i kibana-express-session -u https://github.com/kadishmal/kibana-express-session/releases/download/v1.0.0/kibana-express-session.zip

**Notice** that when specifying a URL via `-u` flag, Kibana requires the URL to point
to a ZIP file which includes all the dependencies. Kibana doesn't run `npm install`
when installing a plugin. So, the ZIP file should be archived and uploaded somewhere.
Follow the **Build** section below for build instructions.

## Options

```yaml
kibana-express-session:
cookieName: ''
# Disable or enable this Kibana plugin.
enabled: true
redis:
host: ''
secret: ''
```
Basically, the same options accepted by `express-session-hapi` module
are accepted by `kibana-express-session`.

## Build

grunt build

This generates a ZIP files into `build/` directory. Upload this archive to the **Releases**
tab in the Github repository.
37 changes: 37 additions & 0 deletions kibana-express-session.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const expressSessionHapi = require('express-session-hapi');

const PLUGIN_NAME = 'kibana-express-session';

module.exports = function (kibana) {
return new kibana.Plugin({
config(Joi) {
return Joi.object({
cookieName: Joi.string(),
enabled: Joi.boolean().default(true),
redirectTo: Joi.string().default('/login'),
redis: Joi.object().keys({
host: Joi.string(),
port: Joi.number().default(6379)
}),
secret: Joi.string(),
sessionIDPrefix: Joi.string(),
userProp: Joi.string().default('user'),
}).default()
},

init: function (server) {
const config = server.config();

server.register(expressSessionHapi, function () {
server.auth.strategy('session', 'cookie', 'required', {
cookieName: config.get(`${PLUGIN_NAME}.cookieName`),
redirectTo: config.get(`${PLUGIN_NAME}.redirectTo`),
redis: config.get(`${PLUGIN_NAME}.redis`),
secret: config.get(`${PLUGIN_NAME}.secret`),
sessionIDPrefix: config.get(`${PLUGIN_NAME}.sessionIDPrefix`),
userProp: config.get(`${PLUGIN_NAME}.userProp`),
});
});
}
});
};
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "kibana-express-session",
"version": "1.0.0",
"description": "express-session compatible Redis backed authentication for Kibana",
"dependencies": {
"express-session-hapi": "1.0.0"
},
"devDependencies": {
"grunt-contrib-compress": "1.2.0",
"grunt": "1.0.1"
},
"engines": {
"node": ">=4"
},
"license": "MIT",
"main": "kibana-express-session.js",
"peerDependencies": {
"hapi": "8.8.1"
},
"repository": {
"type": "git",
"url": "https://github.com/kadishmal/kibana-express-session.git"
}
}

0 comments on commit 636ffe0

Please sign in to comment.