From: wolfgang Date: Tue, 4 Sep 2007 15:58:15 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1164 d1b88da0-ebda-0310... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=866b19ad735c91984291e47acd9636fbcaad627d;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1164 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SoObjects/SOGo/SOGoDAVAuthenticator.h b/SoObjects/SOGo/SOGoDAVAuthenticator.h new file mode 100644 index 00000000..21e06a8a --- /dev/null +++ b/SoObjects/SOGo/SOGoDAVAuthenticator.h @@ -0,0 +1,53 @@ +/* + Copyright (C) 2004-2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#ifndef __Main_SOGoDAVAuthenticator_H__ +#define __Main_SOGoDAVAuthenticator_H__ + +#import + +#import "SOGoAuthenticator.h" + +/* + SOGoDAVAuthenticator + + This just overrides the login/pwd check method and always returns YES since + the password is already checked in Apache. +*/ + +@class NSUserDefaults; +@class NSString; + +@class SOGoUser; + +@interface SOGoDAVAuthenticator : SoHTTPAuthenticator +{ + NSString *authMethod; +} + ++ (id) sharedSOGoDAVAuthenticator; + +- (SOGoUser *) userInContext: (WOContext *) _ctx; +- (NSString *) passwordInContext: (WOContext *) context; + +@end + +#endif /* __Main_SOGoDAVAuthenticator_H__ */ diff --git a/SoObjects/SOGo/SOGoAuthenticator.m b/SoObjects/SOGo/SOGoDAVAuthenticator.m similarity index 95% rename from SoObjects/SOGo/SOGoAuthenticator.m rename to SoObjects/SOGo/SOGoDAVAuthenticator.m index 20856a41..2380e672 100644 --- a/SoObjects/SOGo/SOGoAuthenticator.m +++ b/SoObjects/SOGo/SOGoDAVAuthenticator.m @@ -31,13 +31,13 @@ #import "SOGoPermissions.h" #import "SOGoUser.h" -#import "SOGoAuthenticator.h" +#import "SOGoDAVAuthenticator.h" -@implementation SOGoAuthenticator +@implementation SOGoDAVAuthenticator -+ (id) sharedSOGoAuthenticator ++ (id) sharedSOGoDAVAuthenticator { - static SOGoAuthenticator *auth = nil; + static SOGoDAVAuthenticator *auth = nil; if (!auth) auth = [self new]; @@ -164,4 +164,4 @@ // return rc; // } -@end /* SOGoAuthenticator */ +@end /* SOGoDAVAuthenticator */ diff --git a/SoObjects/SOGo/SOGoWebAuthenticator.h b/SoObjects/SOGo/SOGoWebAuthenticator.h new file mode 100644 index 00000000..464f38dc --- /dev/null +++ b/SoObjects/SOGo/SOGoWebAuthenticator.h @@ -0,0 +1,42 @@ +/* SOGoWebAuthenticator.h - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _SOGOWEBAUTHENTICATOR_H_ +#define _SOGOWEBAUTHENTICATOR_H_ + +#import +#import "SOGoAuthenticator.h" + +@class NSString; + +@class SOGoUser; + +@interface SOGoWebAuthenticator : SoCookieAuthenticator +{ + NSString *authMethod; +} + ++ (id) sharedSOGoWebAuthenticator; + +@end + +#endif /* _SOGOWEBAUTHENTICATOR_H__ */ diff --git a/SoObjects/SOGo/SOGoWebAuthenticator.m b/SoObjects/SOGo/SOGoWebAuthenticator.m new file mode 100644 index 00000000..2ab8cb6e --- /dev/null +++ b/SoObjects/SOGo/SOGoWebAuthenticator.m @@ -0,0 +1,157 @@ +/* SOGoWebAuthenticator.m - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import +#import +#import + +#import +#import +#import +#import +#import + +#import + +#import "LDAPUserManager.h" +#import "SOGoPermissions.h" +#import "SOGoUser.h" + +#import "SOGoWebAuthenticator.h" + +@implementation SOGoWebAuthenticator + ++ (id) sharedSOGoWebAuthenticator +{ + static SOGoWebAuthenticator *auth = nil; + + if (!auth) + auth = [self new]; + + return auth; +} + +- (id) init +{ + if ((self = [super init])) + { + authMethod = [[NSUserDefaults standardUserDefaults] + stringForKey: @"SOGoAuthentificationMethod"]; + [authMethod retain]; + } + + return self; +} + +- (void) dealloc +{ + [authMethod release]; + [super dealloc]; +} + +- (BOOL) checkLogin: (NSString *) _login + password: (NSString *) _pwd +{ + BOOL accept; + LDAPUserManager *um; + + if ([authMethod isEqualToString: @"LDAP"]) + { + um = [LDAPUserManager sharedUserManager]; + accept = [um checkLogin: _login andPassword: _pwd]; + } + else + accept = ([authMethod isEqualToString: @"bypass"] + && [_login length] > 0); + + return accept; +// || ([_login isEqualToString: @"freebusy"] +// && [_pwd isEqualToString: @"freebusy"])); +} + +- (NSString *) passwordInContext: (WOContext *) context +{ + NSArray *creds; + NSString *auth, *password; + + auth = [[context request] cookieValueForKey: + [self cookieNameInContext: context]]; + creds = [self parseCredentials: auth]; + if ([creds count] > 1) + password = [creds objectAtIndex: 1]; + else + password = nil; + + return password; +} + +/* create SOGoUser */ + +- (SOGoUser *) userWithLogin: (NSString *) login + andRoles: (NSArray *) roles + inContext: (WOContext *) ctx +{ + /* the actual factory method */ + return [SOGoUser userWithLogin: login roles: roles]; +} + +- (void) setupAuthFailResponse: (WOResponse *) response + withReason: (NSString *) reason + inContext: (WOContext *) context +{ + id page; + + page = [[WOApplication application] pageWithName: @"SOGoRootPage" + inContext: context]; + [page appendToResponse: response inContext: context]; +} + +// - (BOOL) renderException: (NSException *) exception +// inContext: (WOContext *) context +// { +// id renderedException; +// WOComponent *tmpComponent; +// WOResponse *response; +// BOOL rc; + +// rc = [super renderException: exception inContext: context]; +// if (!rc) +// { +// tmpComponent = [WOComponent new]; +// renderedException = [tmpComponent pageWithName: @"UIxException"]; +// if (renderedException) +// { +// rc = YES; +// response = [context response]; +// [response setHeader: @"text/html" forKey: @"content-type"]; +// [renderedException setClientObject: exception]; +// [context setPage: renderedException]; +// [renderedException appendToResponse: response +// inContext: context]; +// } +// [tmpComponent release]; +// } + +// return rc; +// } + +@end /* SOGoWebAuthenticator */ diff --git a/UI/WebServerResources/attachment.gif b/UI/WebServerResources/attachment.gif new file mode 100644 index 00000000..e12c78fb Binary files /dev/null and b/UI/WebServerResources/attachment.gif differ diff --git a/UI/WebServerResources/lori-login.jpg b/UI/WebServerResources/lori-login.jpg new file mode 100644 index 00000000..306cfca2 Binary files /dev/null and b/UI/WebServerResources/lori-login.jpg differ