#import <NGLdap/NGLdapConnection.h>
#import "SOGoPermissions.h"
-#include "SOGoAuthenticator.h"
-#include "SOGoUser.h"
-#include "common.h"
+#import "LDAPUserManager.h"
+
+#import "SOGoAuthenticator.h"
+#import "SOGoUser.h"
+#import "common.h"
@implementation SOGoAuthenticator
authMethod = [[ud stringForKey:@"AuthentificationMethod"] retain];
if ([authMethod isEqualToString: @"LDAP"])
{
- LDAPBaseDN = [[ud stringForKey:@"LDAPRootDN"] retain];
- LDAPHost = [[ud stringForKey:@"LDAPHost"] retain];
- LDAPPort = [ud integerForKey:@"LDAPPort"];
+// LDAPBaseDN = [[ud stringForKey:@"LDAPRootDN"] retain];
+// LDAPHost = [[ud stringForKey:@"LDAPHost"] retain];
+// LDAPPort = [ud integerForKey:@"LDAPPort"];
}
}
- (BOOL) LDAPCheckLogin: (NSString *) _login
password: (NSString *) _pwd
{
- return [NGLdapConnection checkPassword: _pwd
- ofLogin: _login
- atBaseDN: LDAPBaseDN
- onHost: LDAPHost
- port: LDAPPort];
+ LDAPUserManager *um;
+
+ um = [LDAPUserManager sharedUserManager];
+
+ return [um checkLogin: _login andPassword: _pwd];
}
/* create SOGoUser */
-- (SoUser *) userInContext:(WOContext *)_ctx
+- (SOGoUser *) userInContext: (WOContext *)_ctx
{
- static SoUser *anonymous = nil, *freebusy;
- SoUser *user;
+ static SOGoUser *anonymous = nil, *freebusy;
+ SOGoUser *user;
NSArray *traversalPath;
NSString *login;
if (!anonymous)
anonymous
- = [[SOGoUser alloc] initWithLogin:@"anonymous"
+ = [[SOGoUser alloc] initWithLogin: @"anonymous"
roles: [NSArray arrayWithObject: SoRole_Anonymous]];
if (!freebusy)
freebusy
user = anonymous;
}
else
- user = [[[SOGoUser alloc] initWithLogin: login
- roles: [self rolesForLogin: login]]
- autorelease];
+ user = [SOGoUser userWithLogin: login
+ roles: [self rolesForLogin: login]];
}
else
user = nil;