Move to new directory structure
Original commit: elastic/x-pack-elasticsearch@de5f703b6d
This commit is contained in:
parent
a4670211e5
commit
4cdd0f3bc2
|
@ -1,20 +0,0 @@
|
|||
work
|
||||
.idea
|
||||
agent/logs
|
||||
agent/data
|
||||
agent/target
|
||||
agent/.project
|
||||
agent/.classpath
|
||||
agent/.settings
|
||||
agent/config
|
||||
agent/lib
|
||||
agent/.local-execution-hints.log
|
||||
.DS_Store
|
||||
*.iml
|
||||
*.log
|
||||
node_modules
|
||||
esvm
|
||||
build
|
||||
.aws-config.json
|
||||
html_docs
|
||||
target
|
|
@ -1,63 +0,0 @@
|
|||
const _ = require('lodash');
|
||||
const hapiAuthCookie = require('hapi-auth-cookie');
|
||||
const getAuthHeader = require('./server/lib/get_auth_header');
|
||||
|
||||
module.exports = (kibana) => new kibana.Plugin({
|
||||
name: 'security',
|
||||
require: ['elasticsearch'],
|
||||
|
||||
config(Joi) {
|
||||
return Joi.object({
|
||||
enabled: Joi.boolean().default(true),
|
||||
encryptionKey: Joi.string().required(),
|
||||
sessionTimeout: Joi.number().default(30 * 60 * 1000)
|
||||
}).default()
|
||||
},
|
||||
|
||||
uiExports: {
|
||||
apps: [{
|
||||
id: 'login',
|
||||
title: 'Login',
|
||||
main: 'plugins/security/login',
|
||||
hidden: true,
|
||||
autoload: kibana.autoload.styles
|
||||
}, {
|
||||
id: 'logout',
|
||||
title: 'Logout',
|
||||
main: 'plugins/security/login/logout',
|
||||
hidden: false,
|
||||
autoload: kibana.autoload.styles
|
||||
}]
|
||||
},
|
||||
|
||||
init(server, options) {
|
||||
const isValidUser = require('./server/lib/is_valid_user')(server.plugins.elasticsearch.client);
|
||||
const config = server.config();
|
||||
|
||||
server.register(hapiAuthCookie, (error) => {
|
||||
if (error != null) throw error;
|
||||
|
||||
server.auth.strategy('session', 'cookie', 'required', {
|
||||
cookie: 'sid',
|
||||
password: config.get('security.encryptionKey'),
|
||||
ttl: config.get('security.sessionTimeout'),
|
||||
clearInvalid: true,
|
||||
keepAlive: true,
|
||||
isSecure: false, // TODO: Remove this
|
||||
redirectTo: '/login',
|
||||
validateFunc(request, session, callback) {
|
||||
const {username, password} = session;
|
||||
|
||||
return isValidUser(username, password).then(() => {
|
||||
_.assign(request.headers, getAuthHeader(username, password));
|
||||
return callback(null, true);
|
||||
}, (error) => {
|
||||
return callback(error, false);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
require('./server/routes/authentication')(server, this);
|
||||
}
|
||||
});
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"author": {
|
||||
"name": "Elasticsearch",
|
||||
"company": "Elasticsearch BV"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"precommit": "gulp lint"
|
||||
},
|
||||
"name": "security",
|
||||
"version": "0.0.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/elastic/x-plugins"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"dependencies": {
|
||||
"bluebird": "^3.0.0",
|
||||
"boom": "^2.10.0",
|
||||
"hapi": "^11.0.2",
|
||||
"hapi-auth-cookie": "^3.1.0",
|
||||
"joi": "^6.9.1",
|
||||
"lodash": "^3.10.1"
|
||||
}
|
||||
}
|
|
@ -1,140 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
width="252px"
|
||||
height="45px"
|
||||
viewBox="0 0 252 45"
|
||||
enable-background="new 0 0 252 45"
|
||||
xml:space="preserve"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="kibana.svg"><metadata
|
||||
id="metadata4270"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs4268" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="2046"
|
||||
inkscape:window-height="1132"
|
||||
id="namedview4266"
|
||||
showgrid="false"
|
||||
inkscape:zoom="1.0416667"
|
||||
inkscape:cx="126"
|
||||
inkscape:cy="22.5"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="Layer_1" /><font
|
||||
horiz-adv-x="1000"
|
||||
id="font4232"><!-- "Helvetica Neue" is a trademark of Heidelberger Druckmaschinen AG, which may be registered in certain jurisdictions, exclusivly licensed through Linotype Library GmbH, a wholly owned subsidiary of Heidelberger Druckmaschinen AG. --><font-face
|
||||
font-family="HelveticaNeue-Bold"
|
||||
units-per-em="1000"
|
||||
underline-position="-100"
|
||||
underline-thickness="50"
|
||||
id="font-face4234" /><missing-glyph
|
||||
horiz-adv-x="500"
|
||||
d="M391,607l-280,0l0,-512l280,0M482,698l0,-695l-465,0l0,695z"
|
||||
id="missing-glyph4236" /><glyph
|
||||
unicode="a"
|
||||
horiz-adv-x="574"
|
||||
d="M48,358C50,391 58,419 73,441C88,463 106,481 129,494C152,507 177,517 206,523C234,528 262,531 291,531C317,531 343,529 370,526C397,522 421,515 443,504C465,493 483,479 497,460C511,441 518,415 518,384l0,-269C518,92 519,69 522,48C525,27 529,11 536,0l-144,0C389,8 387,16 386,25C384,33 383,41 382,50C359,27 333,10 302,1C271,-8 240,-13 208,-13C183,-13 160,-10 139,-4C118,2 99,11 83,24C67,37 55,53 46,72C37,91 32,114 32,141C32,170 37,195 48,214C58,233 71,248 88,259C104,270 123,279 144,285C165,290 186,295 207,298C228,301 249,304 270,306C291,308 309,311 325,315C341,319 354,325 363,333C372,340 377,351 376,366C376,381 374,394 369,403C364,412 357,419 349,424C340,429 331,432 320,434C309,435 297,436 284,436C256,436 234,430 218,418C202,406 193,386 190,358M376,253C370,248 363,244 354,241C345,238 335,235 325,233C314,231 303,229 292,228C281,227 269,225 258,223C247,221 237,218 227,215C216,212 207,207 200,202C192,196 186,189 181,180C176,171 174,160 174,147C174,134 176,124 181,115C186,106 192,100 200,95C208,90 217,86 228,84C239,82 250,81 261,81C289,81 311,86 326,95C341,104 353,116 360,129C367,142 372,155 374,168C375,181 376,192 376,200z"
|
||||
id="glyph4238" /><glyph
|
||||
unicode="b"
|
||||
horiz-adv-x="611"
|
||||
d="M433,258C433,237 431,216 426,196C421,176 414,158 404,143C394,128 382,116 367,107C352,98 333,93 312,93C291,93 273,98 258,107C243,116 230,128 220,143C210,158 203,176 198,196C193,216 191,237 191,258C191,280 193,301 198,321C203,341 210,359 220,374C230,389 243,402 258,411C273,420 291,424 312,424C333,424 352,420 367,411C382,402 394,389 404,374C414,359 421,341 426,321C431,301 433,280 433,258M54,714l0,-714l135,0l0,66l2,0C206,37 229,17 259,5C289,-7 323,-13 361,-13C387,-13 413,-8 438,3C463,14 486,30 507,52C527,74 543,102 556,137C569,171 575,212 575,259C575,306 569,347 556,382C543,416 527,444 507,466C486,488 463,504 438,515C413,526 387,531 361,531C329,531 298,525 269,513C239,500 215,481 198,454l-2,0l0,260z"
|
||||
id="glyph4240" /><glyph
|
||||
unicode="i"
|
||||
horiz-adv-x="258"
|
||||
d="M200,597l0,117l-142,0l0,-117M58,517l0,-517l142,0l0,517z"
|
||||
id="glyph4242" /><glyph
|
||||
unicode="k"
|
||||
horiz-adv-x="574"
|
||||
d="M67,714l0,-714l142,0l0,178l55,53l142,-231l172,0l-217,327l195,190l-168,0l-179,-186l0,383z"
|
||||
id="glyph4244" /><glyph
|
||||
unicode="n"
|
||||
horiz-adv-x="593"
|
||||
d="M54,517l0,-517l142,0l0,271C196,324 205,362 222,385C239,408 267,419 306,419C340,419 364,409 377,388C390,367 397,335 397,292l0,-292l142,0l0,318C539,350 536,379 531,406C525,432 515,454 501,473C487,491 468,505 444,516C419,526 388,531 350,531C320,531 291,524 262,511C233,497 210,475 192,445l-3,0l0,72z"
|
||||
id="glyph4246" /></font><rect
|
||||
fill="none"
|
||||
width="252"
|
||||
height="45"
|
||||
id="rect4248"
|
||||
style="opacity:1" /><rect
|
||||
fill="#85C441"
|
||||
width="6.094"
|
||||
height="45"
|
||||
id="rect4250"
|
||||
style="opacity:1" /><rect
|
||||
x="5.958"
|
||||
fill="#2C448E"
|
||||
width="6.094"
|
||||
height="45"
|
||||
id="rect4252"
|
||||
style="opacity:1" /><rect
|
||||
x="12.052"
|
||||
fill="#F2BB1A"
|
||||
width="9.847"
|
||||
height="45"
|
||||
id="rect4254"
|
||||
style="opacity:1" /><rect
|
||||
x="21.899"
|
||||
fill="#3BBEB1"
|
||||
width="6.068"
|
||||
height="45"
|
||||
id="rect4256"
|
||||
style="opacity:1" /><rect
|
||||
x="28.029"
|
||||
fill="#006656"
|
||||
width="2.84"
|
||||
height="45"
|
||||
id="rect4258"
|
||||
style="opacity:1" /><rect
|
||||
x="30.869"
|
||||
fill="#EA458B"
|
||||
width="15.006"
|
||||
height="45"
|
||||
id="rect4260"
|
||||
style="opacity:1" /><rect
|
||||
x="41.5"
|
||||
fill="none"
|
||||
width="207.5"
|
||||
height="74"
|
||||
id="rect4262" /><g
|
||||
style="font-size:64.99947357px;font-family:HelveticaNeue-Bold;letter-spacing:-2.99203849px;opacity:1;fill:#ffffff"
|
||||
id="text4264"><path
|
||||
d="m 45.721,-0.49421886 0,46.40962386 9.229925,0 0,-11.569906 3.574971,-3.444972 9.229926,15.014878 11.179909,0 -14.104886,-21.254828 12.674898,-12.3499 -10.919912,0 -11.634906,12.089903 0,-24.89479886 -9.229925,0 z"
|
||||
style="letter-spacing:-1.33094156px"
|
||||
id="path4912" /><path
|
||||
d="m 90.358907,7.1107196 0,-7.60493846 -9.229925,0 0,7.60493846 9.229925,0 z m -9.229925,5.1999574 0,33.604728 9.229925,0 0,-33.604728 -9.229925,0 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Bold';letter-spacing:-2.87854815px"
|
||||
id="path4914" /><path
|
||||
d="m 119.38291,29.145541 q 0,2.079983 -0.45499,4.029967 -0.455,1.949985 -1.42999,3.444973 -0.97499,1.494987 -2.46998,2.40498 -1.42999,0.844993 -3.50997,0.844993 -2.01499,0 -3.50998,-0.844993 -1.49498,-0.909993 -2.46998,-2.40498 -0.97499,-1.494988 -1.42998,-3.444973 -0.455,-1.949984 -0.455,-4.029967 0,-2.144983 0.455,-4.094967 0.45499,-1.949984 1.42998,-3.444972 0.975,-1.494988 2.46998,-2.339981 1.49499,-0.909993 3.50998,-0.909993 2.07998,0 3.50997,0.909993 1.49499,0.844993 2.46998,2.339981 0.97499,1.494988 1.42999,3.444972 0.45499,1.949984 0.45499,4.094967 z m -24.634798,-29.63975986 0,46.40962386 8.774928,0 0,-4.289965 0.13,0 q 1.49499,2.794977 4.41996,3.964968 2.92498,1.16999 6.62995,1.16999 2.53498,0 5.00496,-1.039991 2.46998,-1.039992 4.41996,-3.184974 2.01499,-2.144983 3.24998,-5.459956 1.23499,-3.379973 1.23499,-7.994935 0,-4.614963 -1.23499,-7.929936 -1.23499,-3.379973 -3.24998,-5.524955 -1.94998,-2.144983 -4.41996,-3.184975 -2.46998,-1.039991 -5.00496,-1.039991 -3.11997,0 -6.04495,1.23499 -2.85998,1.16999 -4.54996,3.769969 l -0.13,0 0,-16.89986286 -9.229928,0 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Bold';letter-spacing:-2.87854815px"
|
||||
id="path4916" /><path
|
||||
d="m 131.21557,22.645594 q 0.195,-3.249974 1.62499,-5.394957 1.42999,-2.144982 3.63997,-3.444972 2.20998,-1.299989 4.93996,-1.819985 2.79498,-0.584995 5.58995,-0.584995 2.53498,0 5.13496,0.389997 2.59998,0.324997 4.74496,1.364989 2.14499,1.039991 3.50997,2.924976 1.36499,1.819985 1.36499,4.87496 l 0,17.484859 q 0,2.274981 0.26,4.354965 0.26,2.079983 0.90999,3.119974 l -9.35992,0 q -0.26,-0.779993 -0.455,-1.559987 -0.13,-0.844993 -0.19499,-1.689986 -2.20999,2.274981 -5.19996,3.184974 -2.98998,0.909992 -6.10995,0.909992 -2.40498,0 -4.48497,-0.584995 -2.07998,-0.584995 -3.63997,-1.819985 -1.55998,-1.23499 -2.46998,-3.119975 -0.84499,-1.884985 -0.84499,-4.484964 0,-2.859976 0.97499,-4.679962 1.03999,-1.884984 2.59998,-2.989975 1.62499,-1.104991 3.63997,-1.624987 2.07998,-0.584995 4.15997,-0.909993 2.07998,-0.324997 4.09496,-0.519996 2.01499,-0.194998 3.57498,-0.584995 1.55998,-0.389997 2.46998,-1.104991 0.90999,-0.779994 0.84499,-2.209982 0,-1.494988 -0.52,-2.339981 -0.45499,-0.909993 -1.29999,-1.364989 -0.77999,-0.519996 -1.88498,-0.649995 -1.03999,-0.194998 -2.27498,-0.194998 -2.72998,0 -4.28997,1.16999 -1.55999,1.169991 -1.81998,3.899969 l -9.22993,0 z m 21.31983,6.824944 q -0.585,0.519996 -1.49499,0.844994 -0.84499,0.259998 -1.88498,0.454996 -0.975,0.194998 -2.07999,0.324997 -1.10499,0.129999 -2.20998,0.324998 -1.03999,0.194998 -2.07998,0.519995 -0.97499,0.324998 -1.75499,0.909993 -0.71499,0.519996 -1.16999,1.364989 -0.455,0.844993 -0.455,2.144983 0,1.23499 0.455,2.079983 0.455,0.844993 1.23499,1.364989 0.77999,0.454996 1.81999,0.649994 1.03999,0.194999 2.14498,0.194999 2.72998,0 4.22496,-0.909993 1.49499,-0.909992 2.20999,-2.144982 0.71499,-1.29999 0.84499,-2.599979 0.195,-1.29999 0.195,-2.079983 l 0,-3.444973 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Bold';letter-spacing:-2.87854815px"
|
||||
id="path4918" /><path
|
||||
d="m 165.92399,12.310677 0,33.604728 9.22992,0 0,-17.614857 q 0,-5.134958 1.68999,-7.344941 1.68999,-2.274981 5.45996,-2.274981 3.31497,0 4.61496,2.079983 1.29999,2.014984 1.29999,6.17495 l 0,18.979846 9.22992,0 0,-20.669832 q 0,-3.119975 -0.58499,-5.654955 -0.52,-2.599978 -1.88499,-4.354964 -1.36499,-1.819986 -3.76997,-2.794978 -2.33998,-1.039991 -6.04495,-1.039991 -2.92497,0 -5.71995,1.364989 -2.79498,1.299989 -4.54996,4.224966 l -0.195,0 0,-4.679963 -8.77493,0 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Bold';letter-spacing:-2.87854815px"
|
||||
id="path4920" /><path
|
||||
d="m 201.24887,22.645594 q 0.195,-3.249974 1.62499,-5.394957 1.42999,-2.144982 3.63997,-3.444972 2.20998,-1.299989 4.93996,-1.819985 2.79498,-0.584995 5.58996,-0.584995 2.53497,0 5.13495,0.389997 2.59998,0.324997 4.74497,1.364989 2.14498,1.039991 3.50997,2.924976 1.36499,1.819985 1.36499,4.87496 l 0,17.484859 q 0,2.274981 0.25999,4.354965 0.26,2.079983 0.91,3.119974 l -9.35993,0 q -0.26,-0.779993 -0.45499,-1.559987 -0.13,-0.844993 -0.195,-1.689986 -2.20998,2.274981 -5.19996,3.184974 -2.98998,0.909992 -6.10995,0.909992 -2.40498,0 -4.48496,-0.584995 -2.07999,-0.584995 -3.63998,-1.819985 -1.55998,-1.23499 -2.46998,-3.119975 -0.84499,-1.884985 -0.84499,-4.484964 0,-2.859976 0.97499,-4.679962 1.04,-1.884984 2.59998,-2.989975 1.62499,-1.104991 3.63997,-1.624987 2.07999,-0.584995 4.15997,-0.909993 2.07998,-0.324997 4.09497,-0.519996 2.01498,-0.194998 3.57497,-0.584995 1.55998,-0.389997 2.46998,-1.104991 0.90999,-0.779994 0.84499,-2.209982 0,-1.494988 -0.52,-2.339981 -0.45499,-0.909993 -1.29998,-1.364989 -0.78,-0.519996 -1.88499,-0.649995 -1.03999,-0.194998 -2.27498,-0.194998 -2.72998,0 -4.28997,1.16999 -1.55998,1.169991 -1.81998,3.899969 l -9.22993,0 z m 21.31983,6.824944 q -0.58499,0.519996 -1.49499,0.844994 -0.84499,0.259998 -1.88498,0.454996 -0.97499,0.194998 -2.07999,0.324997 -1.10499,0.129999 -2.20998,0.324998 -1.03999,0.194998 -2.07998,0.519995 -0.97499,0.324998 -1.75499,0.909993 -0.71499,0.519996 -1.16999,1.364989 -0.45499,0.844993 -0.45499,2.144983 0,1.23499 0.45499,2.079983 0.455,0.844993 1.23499,1.364989 0.78,0.454996 1.81999,0.649994 1.03999,0.194999 2.14498,0.194999 2.72998,0 4.22497,-0.909993 1.49498,-0.909992 2.20998,-2.144982 0.71499,-1.29999 0.84499,-2.599979 0.195,-1.29999 0.195,-2.079983 l 0,-3.444973 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Bold';letter-spacing:-2.87854815px"
|
||||
id="path4922" /></g></svg>
|
Before Width: | Height: | Size: 12 KiB |
|
@ -1,19 +0,0 @@
|
|||
<div class="container">
|
||||
<h1><img ng-src="{{login.kibanaLogoUrl}}" /></h1>
|
||||
|
||||
<form id="login-form" ng-submit="login.submit(username, password)" class="animated infinite bounce">
|
||||
<div ng-show="login.error" class="form-group has-error">
|
||||
<label class="control-label">Oops! Invalid username/password.</label>
|
||||
</div>
|
||||
<div class="form-group inner-addon left-addon">
|
||||
<i class="fa fa-user fa-lg fa-fw"></i>
|
||||
<input type="text" ng-model="username" class="form-control" id="username" name="username" placeholder="Username" />
|
||||
</div>
|
||||
<div class="form-group inner-addon left-addon">
|
||||
<i class="fa fa-lock fa-lg fa-fw"></i>
|
||||
<input type="password" ng-model="password" class="form-control" id="password" name="password" placeholder="Password" />
|
||||
</div>
|
||||
<button type="submit" ng-disabled="!username || !password" class="btn btn-default login">LOG IN</button>
|
||||
<!--<span ng-show="login.loading" class="fa fa-spinner fa-spin"></span>-->
|
||||
</form>
|
||||
</div>
|
|
@ -1,27 +0,0 @@
|
|||
require('plugins/security/login/login.less');
|
||||
|
||||
const kibanaLogoUrl = require('plugins/security/login/kibana-transparent-white.svg');
|
||||
|
||||
require('ui/chrome')
|
||||
.setVisible(false)
|
||||
.setRootTemplate(require('plugins/security/login/login.html'))
|
||||
.setRootController('login', ($http) => {
|
||||
var login = {
|
||||
loading: false,
|
||||
kibanaLogoUrl
|
||||
};
|
||||
|
||||
login.submit = (username, password) => {
|
||||
login.loading = true;
|
||||
|
||||
$http.post('/login', {
|
||||
username: username,
|
||||
password: password
|
||||
}).then(
|
||||
(response) => window.location.href = '/', // TODO: Redirect more intelligently
|
||||
(error) => login.error = true
|
||||
).finally(() => login.loading = false);
|
||||
};
|
||||
|
||||
return login;
|
||||
});
|
|
@ -1,52 +0,0 @@
|
|||
@import "~ui/styles/variables/bootstrap-mods.less";
|
||||
|
||||
body {
|
||||
background: @gray2;
|
||||
}
|
||||
|
||||
.inner-addon {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.inner-addon .fa {
|
||||
position: absolute;
|
||||
padding: 10px;
|
||||
pointer-events: none;
|
||||
color: @gray10;
|
||||
}
|
||||
|
||||
.left-addon .fa { left: 0px;}
|
||||
.right-addon .fa { right: 0px;}
|
||||
|
||||
.left-addon input { padding-left: 30px !important; }
|
||||
.right-addon input { padding-right: 30px !important; }
|
||||
|
||||
.container {
|
||||
width: 350px;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
|
||||
h1, button {
|
||||
margin: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.login {
|
||||
background-color: @esGreen;
|
||||
color: white;
|
||||
width: 200px;
|
||||
font-size: 1.5em;
|
||||
border: none;
|
||||
|
||||
&:disabled {
|
||||
background-color: @esGreen2;
|
||||
color: @gray;
|
||||
}
|
||||
}
|
||||
|
||||
input.form-control {
|
||||
border: none;
|
||||
font-size: 1.25em;
|
||||
height: auto;
|
||||
padding: 0.5em;
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
module.exports = (username, password) => {
|
||||
const auth = new Buffer(`${username}:${password}`, 'utf8').toString('base64');
|
||||
return {'Authorization': `Basic ${auth}`};
|
||||
};
|
|
@ -1,5 +0,0 @@
|
|||
const getAuthHeader = require('./get_auth_header');
|
||||
|
||||
module.exports = (client) => (username, password) => client.info({
|
||||
headers: getAuthHeader(username, password)
|
||||
});
|
|
@ -1,53 +0,0 @@
|
|||
const Boom = require('boom');
|
||||
const Joi = require('joi');
|
||||
|
||||
module.exports = (server, uiExports) => {
|
||||
const login = uiExports.apps.byId.login;
|
||||
const isValidUser = require('../lib/is_valid_user')(server.plugins.elasticsearch.client);
|
||||
|
||||
server.route({
|
||||
method: 'GET',
|
||||
path: '/login',
|
||||
handler(request, reply) {
|
||||
return reply.renderApp(login);
|
||||
},
|
||||
config: {
|
||||
auth: false
|
||||
}
|
||||
});
|
||||
|
||||
server.route({
|
||||
method: 'POST',
|
||||
path: '/login',
|
||||
handler(request, reply) {
|
||||
return isValidUser(request.payload.username, request.payload.password).then(() => {
|
||||
request.auth.session.set({username: request.payload.username, password: request.payload.password});
|
||||
return reply({
|
||||
statusCode: 200,
|
||||
payload: 'success'
|
||||
});
|
||||
}, (error) => {
|
||||
request.auth.session.clear();
|
||||
return reply(Boom.unauthorized(error));
|
||||
})
|
||||
},
|
||||
config: {
|
||||
auth: false,
|
||||
validate: {
|
||||
payload: {
|
||||
username: Joi.string().required(),
|
||||
password: Joi.string().required()
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
server.route({
|
||||
method: 'GET',
|
||||
path: '/app/logout', // TODO: Change to /logout
|
||||
handler(request, reply) {
|
||||
request.auth.session.clear();
|
||||
return reply.redirect('/');
|
||||
}
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue