2 Copyright (C) 2004-2005 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #import <NGObjWeb/WOApplication.h>
23 #import <NGObjWeb/WOContext.h>
24 #import <NGObjWeb/WOCookie.h>
25 #import <NGObjWeb/WORequest.h>
26 #import <NGObjWeb/WOResponse.h>
27 #import <NGExtensions/NGBase64Coding.h>
28 #import <NGExtensions/NSNull+misc.h>
29 #import <NGExtensions/NSString+misc.h>
30 #import <NGExtensions/NSObject+Logs.h>
32 #import <SoObjects/SOGo/SOGoWebAuthenticator.h>
33 #import <SoObjects/SOGo/SOGoUser.h>
35 #import "SOGoRootPage.h"
37 @implementation SOGoRootPage
47 - (void) setUserName: (NSString *) _value
49 ASSIGNCOPY (userName, _value);
52 - (NSString *) userName
57 - (NSString *) connectURL
59 return [NSString stringWithFormat: @"%@connect", [self applicationPath]];
63 - (id <WOActionResults>) connectAction
67 SOGoWebAuthenticator *auth;
68 NSString *cookieValue, *cookieString;
70 auth = [[WOApplication application]
71 authenticatorInContext: context];
72 response = [self responseWith204];
73 cookieString = [NSString stringWithFormat: @"%@:%@",
74 [self queryParameterForKey: @"userName"],
75 [self queryParameterForKey: @"password"]];
76 cookieValue = [NSString stringWithFormat: @"basic %@",
77 [cookieString stringByEncodingBase64]];
78 authCookie = [WOCookie cookieWithName: [auth cookieNameInContext: context]
80 [authCookie setPath: @"/"];
81 [response addCookie: authCookie];
86 - (id <WOActionResults>) defaultAction
88 id <WOActionResults> response;
89 NSString *login, *oldLocation;
91 login = [[context activeUser] login];
92 if ([login isEqualToString: @"anonymous"])
96 oldLocation = [[self clientObject] baseURLInContext: context];
98 = [self redirectToLocation: [NSString stringWithFormat: @"%@/%@",
105 - (BOOL) isPublicInContext: (WOContext *) localContext
110 @end /* SOGoRootPage */