Closed mdridzuan80 closed 8 years ago
Hi @typ90,
I'm having the same issue. I added a server method to display the LDAP_DEFAULTS (and it does show the same values I entered into the Meteor.isServer section):
Meteor.methods({
'LDAP_DEFAULTS': function() {
console.log(LDAP_DEFAULTS.url);
console.log(LDAP_DEFAULTS.dn);
},
Server console log:
I20151014-16:22:45.320? ldap://ldap.xxx.yyy.com
I20151014-16:22:45.320? ou=people,dc=xxx,dc=yyy,dc=com
That method is called when I attempt to login:
"click #login": function(event){
var userName = "me";
var password = "1234";
Meteor.call('LDAP_DEFAULTS');
Meteor.loginWithLDAP(userName, password, {
dn: "uid="+userName+",ou=people,dc=xxx,dc=yyy,dc=com"
}, function(err){
if (err) console.log(err.message);
else console.log("login passed!");
});
},
The browser console output shows:
Options not set. Make sure to set LDAP_DEFAULTS.url and LDAP_DEFAULTS.dn! [Bad Defaults]
I'm hoping we're just missing a simple configuration step. Thanks in advance.
I'm also experiencing the same issue
I have the same issue here. Here's a simple example program:
example.html
<head>
<title>LDAP example login</title>
</head>
<body>
{{> login}}
</body>
<template name="login">
<button>Login</button>
</template>
example.js
if (Meteor.isClient) {
Template.login.events({
'click button': function(event) {
// See https://github.com/typ90/meteor-accounts-ldap/#server-side-configuration
Meteor.loginWithLDAP('gauss', 'password', function(err) {
if (err) {
console.log(err.reason);
}
});
}
});
}
if (Meteor.isServer) {
// See https://github.com/typ90/meteor-accounts-ldap/#server-side-configuration
LDAP_DEFAULTS.url = 'ldap.forumsys.com';
LDAP_DEFAULTS.dn = 'cn=read-only-admin,dc=example,dc=com';
Meteor.startup(function () {
// code to run on server at startup
// Prevent account creation
Accounts.config({
forbidClientAccountCreation: true
});
});
}
Console output when clicking on the Login button.
Options not set. Make sure to set LDAP_DEFAULTS.url and LDAP_DEFAULTS.dn!
For testing I'm using the publically available LDAP server I found here: http://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/.
Looks like this is due to dependencies missing from the package, . It requires the check
package so meteor add check
should work.
Ah, looks like that did the trick, thanks @pmgration!
Looking into why this this is happening..when upgrading from <1.2.x to 1.2.x the meteor-platform package is removed and the packages that made up meteor-platform are now installed individually (making it more modular), one of these is the check
package. When creating a new 1.2.x project, check
isn't installed by default so that's why it needs adding and why it probably would have worked if upgrading. The package.js for this should be updated to add the dependency, I'll look at doing it at some point and make a PR unless someone gets there first.
meteor version 1.2.0.1, want authenticate with ad,
this is my code:
if (Meteor.isClient) { // counter starts at 0 Session.setDefault('counter', 0);
Template.hello.helpers({ counter: function () { return Session.get('counter'); } });
Template.hello.events({ 'click button': function () { // increment the counter when button is clicked Session.set('counter', Session.get('counter') + 1); } });
}
if (Meteor.isServer) { Meteor.startup(function () { // code to run on server at startup LDAP_DEFAULTS.url = 'ldap://172.16.25.28'; }); }
console show message: Options not set. Make sure to set LDAP_DEFAULTS.url and LDAP_DEFAULTS.dn!
Please help..