mirror of
https://github.com/openstf/stf
synced 2025-10-04 10:19:30 +02:00
add openid to options
This commit is contained in:
parent
e8a2a6637f
commit
4c2da1056d
2 changed files with 37 additions and 11 deletions
38
lib/cli.js
38
lib/cli.js
|
@ -573,6 +573,42 @@ program
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('auth-openid')
|
||||||
|
.description('start openid auth client')
|
||||||
|
.option('-p, --port <port>'
|
||||||
|
, 'port (or $PORT)'
|
||||||
|
, Number
|
||||||
|
, process.env.PORT || 7120)
|
||||||
|
.option('-s, --secret <secret>'
|
||||||
|
, 'secret (or $SECRET)'
|
||||||
|
, String
|
||||||
|
, process.env.SECRET)
|
||||||
|
.option('-a, --app-url <url>'
|
||||||
|
, 'URL to app'
|
||||||
|
, String)
|
||||||
|
.option('--identifier <identifier>'
|
||||||
|
, 'identifier'
|
||||||
|
, String)
|
||||||
|
.action(function(options) {
|
||||||
|
if (!options.identifier) {
|
||||||
|
this.missingArgument('--identifier')
|
||||||
|
}
|
||||||
|
if (!options.secret) {
|
||||||
|
this.missingArgument('--secret')
|
||||||
|
}
|
||||||
|
if (!options.appUrl) {
|
||||||
|
this.missingArgument('--app-url')
|
||||||
|
}
|
||||||
|
|
||||||
|
require('./units/auth/openid')({
|
||||||
|
port: options.port,
|
||||||
|
secret: options.secret,
|
||||||
|
appUrl: options.appUrl,
|
||||||
|
identifier: options.identifier
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
program
|
program
|
||||||
.command('notify-hipchat')
|
.command('notify-hipchat')
|
||||||
.description('start HipChat notifier')
|
.description('start HipChat notifier')
|
||||||
|
@ -1014,7 +1050,7 @@ program
|
||||||
, 'device pull endpoint'
|
, 'device pull endpoint'
|
||||||
, String
|
, String
|
||||||
, 'tcp://127.0.0.1:7116')
|
, 'tcp://127.0.0.1:7116')
|
||||||
.option('--auth-type <mock|ldap|oauth2|saml2>'
|
.option('--auth-type <mock|ldap|oauth2|saml2|openid>'
|
||||||
, 'auth type'
|
, 'auth type'
|
||||||
, String
|
, String
|
||||||
, 'mock')
|
, 'mock')
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
var http = require('http')
|
var http = require('http')
|
||||||
|
|
||||||
var urljoin = require('url-join')
|
var urljoin = require('url-join')
|
||||||
var express = require('express')
|
var express = require('express')
|
||||||
var validator = require('express-validator')
|
var validator = require('express-validator')
|
||||||
|
@ -28,7 +27,6 @@ var extensions = [new openid.SimpleRegistration({
|
||||||
|
|
||||||
module.exports = function(options) {
|
module.exports = function(options) {
|
||||||
var verifyUrl = urljoin(options.appUrl, "/auth/verify");
|
var verifyUrl = urljoin(options.appUrl, "/auth/verify");
|
||||||
console.log(verifyUrl);
|
|
||||||
|
|
||||||
var relyingParty = new openid.RelyingParty(
|
var relyingParty = new openid.RelyingParty(
|
||||||
verifyUrl,
|
verifyUrl,
|
||||||
|
@ -42,14 +40,6 @@ module.exports = function(options) {
|
||||||
, app = express()
|
, app = express()
|
||||||
, server = Promise.promisifyAll(http.createServer(app))
|
, server = Promise.promisifyAll(http.createServer(app))
|
||||||
|
|
||||||
// lifecycle.observe(function() {
|
|
||||||
// log.info('Waiting for client connections to end')
|
|
||||||
// return server.closeAsync()
|
|
||||||
// .catch(function() {
|
|
||||||
// // Okay
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
|
|
||||||
app.set('strict routing', true)
|
app.set('strict routing', true)
|
||||||
app.set('case sensitive routing', true)
|
app.set('case sensitive routing', true)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue