2011-08-04 20:32:01 +00:00
|
|
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
|
|
|
|
2020-10-31 21:07:32 +00:00
|
|
|
const logger = require('./logger')
|
|
|
|
|
|
|
|
const client = require('./client')
|
2023-02-21 18:28:58 +00:00
|
|
|
const Attribute = require('@ldapjs/attribute')
|
|
|
|
const Change = require('@ldapjs/change')
|
2022-06-06 02:01:40 +00:00
|
|
|
const Protocol = require('@ldapjs/protocol')
|
2020-10-31 21:07:32 +00:00
|
|
|
const Server = require('./server')
|
|
|
|
|
|
|
|
const controls = require('./controls')
|
|
|
|
const persistentSearch = require('./persistent_search')
|
2023-02-21 18:28:58 +00:00
|
|
|
const dn = require('@ldapjs/dn')
|
2020-10-31 21:07:32 +00:00
|
|
|
const errors = require('./errors')
|
2022-06-26 20:59:35 +00:00
|
|
|
const filters = require('@ldapjs/filter')
|
2020-10-31 21:07:32 +00:00
|
|
|
const messages = require('./messages')
|
|
|
|
const url = require('./url')
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
const hasOwnProperty = (target, val) => Object.prototype.hasOwnProperty.call(target, val)
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
/// --- API
|
2011-08-04 20:32:01 +00:00
|
|
|
|
|
|
|
module.exports = {
|
2015-10-28 02:52:43 +00:00
|
|
|
Client: client.Client,
|
2012-04-27 03:23:43 +00:00
|
|
|
createClient: client.createClient,
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2023-02-22 17:28:36 +00:00
|
|
|
Server,
|
2012-02-24 00:02:52 +00:00
|
|
|
createServer: function (options) {
|
2019-08-27 21:11:49 +00:00
|
|
|
if (options === undefined) { options = {} }
|
2012-02-18 08:54:22 +00:00
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
if (typeof (options) !== 'object') { throw new TypeError('options (object) required') }
|
2012-02-18 08:54:22 +00:00
|
|
|
|
|
|
|
if (!options.log) {
|
2019-08-27 21:11:49 +00:00
|
|
|
options.log = logger
|
2012-02-18 08:54:22 +00:00
|
|
|
}
|
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
return new Server(options)
|
2011-08-06 20:44:26 +00:00
|
|
|
},
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2023-02-22 17:28:36 +00:00
|
|
|
Attribute,
|
|
|
|
Change,
|
2011-12-08 01:02:17 +00:00
|
|
|
|
2023-02-22 17:28:36 +00:00
|
|
|
dn,
|
2011-08-04 20:32:01 +00:00
|
|
|
DN: dn.DN,
|
2011-08-10 17:57:58 +00:00
|
|
|
RDN: dn.RDN,
|
2023-02-21 18:28:58 +00:00
|
|
|
parseDN: dn.DN.fromString,
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2023-02-22 17:28:36 +00:00
|
|
|
persistentSearch,
|
2015-06-15 01:51:14 +00:00
|
|
|
PersistentSearchCache: persistentSearch.PersistentSearchCache,
|
2012-02-23 23:21:17 +00:00
|
|
|
|
2023-02-22 17:28:36 +00:00
|
|
|
filters,
|
2011-08-04 20:32:01 +00:00
|
|
|
parseFilter: filters.parseString,
|
|
|
|
|
2023-02-22 17:28:36 +00:00
|
|
|
url,
|
2015-06-15 01:51:14 +00:00
|
|
|
parseURL: url.parse
|
2019-08-27 21:11:49 +00:00
|
|
|
}
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
/// --- Export all the childrenz
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2020-10-31 21:07:32 +00:00
|
|
|
let k
|
2011-08-04 20:32:01 +00:00
|
|
|
|
|
|
|
for (k in Protocol) {
|
2019-08-27 21:11:49 +00:00
|
|
|
if (hasOwnProperty(Protocol, k)) { module.exports[k] = Protocol[k] }
|
2011-08-04 20:32:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (k in messages) {
|
2019-08-27 21:11:49 +00:00
|
|
|
if (hasOwnProperty(messages, k)) { module.exports[k] = messages[k] }
|
2011-08-04 20:32:01 +00:00
|
|
|
}
|
|
|
|
|
2011-12-09 21:59:17 +00:00
|
|
|
for (k in controls) {
|
2019-08-27 21:11:49 +00:00
|
|
|
if (hasOwnProperty(controls, k)) { module.exports[k] = controls[k] }
|
2011-12-09 21:59:17 +00:00
|
|
|
}
|
|
|
|
|
2011-08-04 20:32:01 +00:00
|
|
|
for (k in filters) {
|
2019-08-27 21:11:49 +00:00
|
|
|
if (hasOwnProperty(filters, k)) {
|
|
|
|
if (k !== 'parse' && k !== 'parseString') { module.exports[k] = filters[k] }
|
2011-08-04 20:32:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (k in errors) {
|
2019-08-27 21:11:49 +00:00
|
|
|
if (hasOwnProperty(errors, k)) {
|
|
|
|
module.exports[k] = errors[k]
|
2011-08-04 20:32:01 +00:00
|
|
|
}
|
|
|
|
}
|