From 866b19ad735c91984291e47acd9636fbcaad627d Mon Sep 17 00:00:00 2001 From: wolfgang Date: Tue, 4 Sep 2007 15:58:15 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1164 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SoObjects/SOGo/SOGoDAVAuthenticator.h | 53 ++++++ ...Authenticator.m => SOGoDAVAuthenticator.m} | 10 +- SoObjects/SOGo/SOGoWebAuthenticator.h | 42 +++++ SoObjects/SOGo/SOGoWebAuthenticator.m | 157 ++++++++++++++++++ UI/WebServerResources/attachment.gif | Bin 0 -> 971 bytes UI/WebServerResources/lori-login.jpg | Bin 0 -> 5849 bytes 6 files changed, 257 insertions(+), 5 deletions(-) create mode 100644 SoObjects/SOGo/SOGoDAVAuthenticator.h rename SoObjects/SOGo/{SOGoAuthenticator.m => SOGoDAVAuthenticator.m} (95%) create mode 100644 SoObjects/SOGo/SOGoWebAuthenticator.h create mode 100644 SoObjects/SOGo/SOGoWebAuthenticator.m create mode 100644 UI/WebServerResources/attachment.gif create mode 100644 UI/WebServerResources/lori-login.jpg 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 0000000000000000000000000000000000000000..e12c78fb549eae7839b9cfe8a7c0088c46b5a487 GIT binary patch literal 971 zcmeIx+e=dc9KiA8{WN?SXr&M_L#&{epa;VqG-Fl}Vb4(-N&3W1FZ0BspZEkZqr*3ZNx--vpXWH3c(Mun`{NVTcgI~ujZS&P`HJ}Dk z1HkA=%J41qU*gm0DS%R&3PjvJ$+yJ8j;z<~bvv_=D+|N0$EB=W2!ePZ#tSh%pAYshu$S@s11O3jFym7~7!-~9kz61U z@cVM8FBc33*ZsLrC=@_*!S%y%I2;NbhJs4$Mu-h>5aHrvBVjfci$x=BG{S90x!5MR z731RD$@n(E6Xz2<{BDBZ+ZFcrgyg=EObV%_kWQx$Qeyf*#4s$A7O{*-5Co1(1TIk& zMUu*tXeyso(0L}C&oOycaVWE_%yAsg$vn>sf*=+ZBvF)tVsDJ_B5}+vl1OOUqmz^o_^MM zzY)|7f4cn8)YEC}g&g`W%afUVy{g)#jt8o8-Ky*Tg*)%m;@kGe?HBKUs5@aB(GH!| zmT2k|Wv{DGoxkyXa7_Q|O>N`#eni)hQPrHg)@SYNE`4dxH20WW8(!!uz^{)Cnx(d~ eiYit0prmUnEi11CLEXd`n|-+c_Srf$(DD~mv=2}K literal 0 HcmV?d00001 diff --git a/UI/WebServerResources/lori-login.jpg b/UI/WebServerResources/lori-login.jpg new file mode 100644 index 0000000000000000000000000000000000000000..306cfca25030962ace4de872a18723bd2d26f79b GIT binary patch literal 5849 zcmb7IcT`i&o4z3l0jVJfNN>`lcSK5*-kTsGO79?DM5K$-2}QaXdRIUc5u{6#l7MtX zz|fn3QUtR>zi)Sc=j=Z__uQFx%AIp(p64wy_(}X%fLcpUQw;zSk|0PB0PqU{oob+q zBLL{?0s;U4kPu!%!p{IV04Nv&fqh_nSTr;G+t@Yu4{1!X^sq$ zO3V{cJ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