Skip to content

Commit 2bb705e

Browse files
committed
fix: no restart required when bindDN changes
1 parent 1023fe0 commit 2bb705e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/service-ldap.mjs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ export class ServiceLDAP extends Service {
1616
type: "url"
1717
},
1818
bindDN: {
19-
needsRestart: true,
2019
type: "string"
2120
},
2221
entitlements: {
22+
description: "attributes to build a entitlement query",
2323
attributes: {
2424
base: {
2525
type: "string"
@@ -54,7 +54,7 @@ export class ServiceLDAP extends Service {
5454
}
5555

5656
/**
57-
* authorize user / password
57+
* authorize with username and password
5858
* @param {Object} props
5959
* @param {string} props.username
6060
* @param {string} props.password
@@ -74,19 +74,23 @@ export class ServiceLDAP extends Service {
7474
}
7575

7676
try {
77-
this.trace(`bind ${expand(this.bindDN)}`);
78-
await this.client.bind(expand(this.bindDN), password);
77+
constant bindDN = expand(this.bindDN);
78+
79+
this.trace(`bind ${bindDN}`);
80+
await this.client.bind(bindDN, password);
7981

8082
const searchOptions = {
8183
scope: this.entitlements.scope,
8284
filter: expand(this.entitlements.filter),
8385
attributes: [this.entitlements.attribute]
8486
};
8587

86-
this.trace(`search ${expand(this.entitlements.base)} ${JSON.stringify(searchOptions)}`);
88+
const base = expand(this.entitlements.base);
89+
90+
this.trace(`search ${base} ${JSON.stringify(searchOptions)}`);
8791

8892
const { searchEntries } = await this.client.search(
89-
expand(this.entitlements.base),
93+
base,
9094
searchOptions
9195
);
9296

0 commit comments

Comments
 (0)