mirror of
https://github.com/openstf/stf
synced 2025-10-03 17:59:28 +02:00
Add mock auth for development.
This commit is contained in:
parent
97f37ad507
commit
60143b28cb
3 changed files with 128 additions and 18 deletions
50
lib/cli.js
50
lib/cli.js
|
@ -124,8 +124,8 @@ program
|
|||
})
|
||||
|
||||
program
|
||||
.command('auth')
|
||||
.description('start auth server')
|
||||
.command('auth-ldap')
|
||||
.description('start LDAP auth client')
|
||||
.option('-p, --port <port>'
|
||||
, 'port (or $PORT)'
|
||||
, Number
|
||||
|
@ -163,27 +163,51 @@ program
|
|||
, 'user')
|
||||
.action(function(options) {
|
||||
var env = process.env
|
||||
require('./roles/auth')({
|
||||
require('./roles/auth/ldap')({
|
||||
port: env.PORT || options.port
|
||||
, secret: env.SECRET || options.secret
|
||||
, ssid: env.SSID || options.ssid
|
||||
, secret: options.secret || env.SECRET
|
||||
, ssid: options.ssid || env.SSID
|
||||
, ldap: {
|
||||
url: env.LDAP_URL || options.ldapUrl
|
||||
, timeout: env.LDAP_TIMEOUT || options.ldapTimeout
|
||||
url: options.ldapUrl || env.LDAP_URL
|
||||
, timeout: options.ldapTimeout || env.LDAP_TIMEOUT
|
||||
, bind: {
|
||||
dn: env.LDAP_BIND_DN || options.ldapBindDn
|
||||
, credentials: env.LDAP_BIND_CREDENTIALS || options.ldapBindCredentials
|
||||
dn: options.ldapBindDn || env.LDAP_BIND_DN
|
||||
, credentials: options.ldapBindCredentials || env.LDAP_BIND_CREDENTIALS
|
||||
}
|
||||
, search: {
|
||||
dn: env.LDAP_SEARCH_DN || options.ldapSearchDn
|
||||
, scope: env.LDAP_SEARCH_SCOPE || options.ldapSearchScope
|
||||
, objectClass: env.LDAP_SEARCH_CLASS || options.ldapSearchClass
|
||||
, loginField: env.LDAP_SEARCH_LOGINFIELD || options.ldapSearchLoginField
|
||||
dn: options.ldapSearchDn || env.LDAP_SEARCH_DN
|
||||
, scope: options.ldapSearchScope || env.LDAP_SEARCH_SCOPE
|
||||
, objectClass: options.ldapSearchClass || env.LDAP_SEARCH_CLASS
|
||||
, loginField: options.ldapSearchLoginField || env.LDAP_SEARCH_LOGINFIELD
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
program
|
||||
.command('auth-mock')
|
||||
.description('start mock auth client')
|
||||
.option('-p, --port <port>'
|
||||
, 'port (or $PORT)'
|
||||
, Number
|
||||
, 7100)
|
||||
.option('-s, --secret <secret>'
|
||||
, 'secret (or $SECRET)'
|
||||
, String)
|
||||
.option('-i, --ssid <ssid>'
|
||||
, 'session SSID (or $SSID)'
|
||||
, String
|
||||
, 'ssid')
|
||||
.action(function(options) {
|
||||
var env = process.env
|
||||
require('./roles/auth/mock')({
|
||||
port: env.PORT || options.port
|
||||
, secret: options.secret || env.SECRET
|
||||
, ssid: options.ssid || env.SSID
|
||||
})
|
||||
})
|
||||
|
||||
program
|
||||
.command('console')
|
||||
.description('start console')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue