|
|
@@ -47,10 +47,7 @@ class PassportService {
|
|
|
*
|
|
|
* @memberof PassportService
|
|
|
*/
|
|
|
- setupLocalStrategy(isForce) {
|
|
|
- if (isForce === true) {
|
|
|
- this.resetLocalStrategy();
|
|
|
- }
|
|
|
+ setupLocalStrategy() {
|
|
|
// check whether the strategy has already been set up
|
|
|
if (this.isLocalStrategySetup) {
|
|
|
throw new Error('LocalStrategy has already been set up');
|
|
|
@@ -98,18 +95,22 @@ class PassportService {
|
|
|
*
|
|
|
* @memberof PassportService
|
|
|
*/
|
|
|
- setupLdapStrategy(isForce) {
|
|
|
- if (isForce === true) {
|
|
|
- this.resetLdapStrategy();
|
|
|
- }
|
|
|
+ setupLdapStrategy() {
|
|
|
// check whether the strategy has already been set up
|
|
|
if (this.isLdapStrategySetup) {
|
|
|
throw new Error('LdapStrategy has already been set up');
|
|
|
}
|
|
|
|
|
|
- debug('LdapStrategy: setting up..');
|
|
|
-
|
|
|
const config = this.crowi.config;
|
|
|
+ const Config = this.crowi.model('Config');
|
|
|
+ const isLdapEnabled = Config.isEnabledPassportLdap(config);
|
|
|
+
|
|
|
+ // when disabled
|
|
|
+ if (!isLdapEnabled) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ debug('LdapStrategy: setting up..');
|
|
|
|
|
|
// get configurations
|
|
|
const isUserBind = config.crowi['security:passport-ldap:isUserBind'];
|