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>
28 #import <NGExtensions/NGBase64Coding.h>
29 #import <NGExtensions/NSNull+misc.h>
30 #import <NGExtensions/NSString+misc.h>
31 #import <NGExtensions/NSObject+Logs.h>
33 #import <SoObjects/SOGo/SOGoWebAuthenticator.h>
34 #import <SoObjects/SOGo/SOGoUser.h>
36 #import "SOGoRootPage.h"
38 @implementation SOGoRootPage
48 - (void) setUserName: (NSString *) _value
50 ASSIGNCOPY (userName, _value);
53 - (NSString *) userName
58 - (NSString *) connectURL
60 return [NSString stringWithFormat: @"%@connect", [self applicationPath]];
64 - (id <WOActionResults>) connectAction
69 SOGoWebAuthenticator *auth;
70 NSString *cookieValue, *cookieString;
72 auth = [[WOApplication application]
73 authenticatorInContext: context];
74 request = [context request];
75 response = [self responseWith204];
76 cookieString = [NSString stringWithFormat: @"%@:%@",
77 [request formValueForKey: @"userName"],
78 [request formValueForKey: @"password"]];
79 cookieValue = [NSString stringWithFormat: @"basic %@",
80 [cookieString stringByEncodingBase64]];
81 authCookie = [WOCookie cookieWithName: [auth cookieNameInContext: context]
83 [authCookie setPath: @"/"];
84 [response addCookie: authCookie];
89 - (id <WOActionResults>) defaultAction
91 id <WOActionResults> response;
92 NSString *login, *oldLocation;
94 login = [[context activeUser] login];
95 if (!login || [login isEqualToString: @"anonymous"])
99 oldLocation = [[self clientObject] baseURLInContext: context];
101 = [self redirectToLocation: [NSString stringWithFormat: @"%@/%@",
102 oldLocation, login]];
108 - (BOOL) isPublicInContext: (WOContext *) localContext
113 @end /* SOGoRootPage */