Browse Source

feat: LDAP debug flag

pull/880/head
Nick 5 years ago
parent
commit
922f179a90
7 changed files with 18 additions and 12 deletions
  1. 17
      client/components/admin/admin-dev-flags.vue
  2. 1
      server/app/data.yml
  3. 1
      server/core/auth.js
  4. 5
      server/graph/resolvers/authentication.js
  5. 1
      server/graph/resolvers/site.js
  6. 2
      server/helpers/graph.js
  7. 3
      server/modules/authentication/ldap/authentication.js

17
client/components/admin/admin-dev-flags.vue

@ -17,6 +17,14 @@
span Do NOT enable these flags unless you know what you're doing!
.caption Doing so may result in data loss or broken installation!
v-card-text
v-switch.mt-3(
color='primary'
hint='Log detailed debug info on LDAP/AD login attempts.'
persistent-hint
label='LDAP Debug'
v-model='flags.ldapdebug'
)
v-divider.mt-3
v-switch.mt-3(
color='red'
hint='Log all queries made to the database to console.'
@ -24,15 +32,6 @@
label='SQL Query Logging'
v-model='flags.sqllog'
)
//- v-divider.mt-3
//- v-switch.mt-3(
//- color='primary'
//- hint='Log all queries made to the database to console.'
//- persistent-hint
//- label='SQL Query Log'
//- v-model='flags.sqllog'
//- )
</template>
<script>

1
server/app/data.yml

@ -39,6 +39,7 @@ defaults:
theme: 'default'
darkMode: false
flags:
ldapdebug: false
sqllog: false
# System defaults
setup: false

1
server/core/auth.js

@ -1,6 +1,5 @@
const passport = require('passport')
const passportJWT = require('passport-jwt')
const fs = require('fs-extra')
const _ = require('lodash')
const path = require('path')
const jwt = require('jsonwebtoken')

5
server/graph/resolvers/authentication.js

@ -44,6 +44,11 @@ module.exports = {
responseResult: graphHelper.generateSuccess('Login success')
}
} catch (err) {
// LDAP Debug Flag
if (args.strategy === 'ldap' && WIKI.config.flags.ldapdebug) {
WIKI.logger.warn('LDAP LOGIN ERROR (c1): ', err)
}
return graphHelper.generateError(err)
}
},

1
server/graph/resolvers/site.js

@ -1,4 +1,3 @@
const _ = require('lodash')
const graphHelper = require('../../helpers/graph')
/* global WIKI */

2
server/helpers/graph.js

@ -13,7 +13,7 @@ module.exports = {
generateError (err, complete = true) {
const error = {
succeeded: false,
errorCode: err.code || 1,
errorCode: _.isFinite(err.code) ? err.code : 1,
slug: err.name,
message: err.message || 'An unexpected error occured.'
}

3
server/modules/authentication/ldap/authentication.js

@ -45,6 +45,9 @@ module.exports = {
})
cb(null, user)
} catch (err) {
if (WIKI.config.flags.ldapdebug) {
WIKI.logger.warn('LDAP LOGIN ERROR (c2): ', err)
}
cb(err, null)
}
}

Loading…
Cancel
Save