diff --git a/ChangeLog b/ChangeLog index b55f7b3f8..7a44e8763 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2007-09-06 Wolfgang Sourdeau + * SoObjects/SOGo/SOGoWebAuthenticator.m ([SOGoWebAuthenticator + -preprocessCredentialsInContext:context]): consider the user + anonymous if the cookie value is "discard". + ([SOGoWebAuthenticator + -setupAuthFailResponse:responsewithReason:reasoninContext:context]): + set the expiration date of the cookie to yesterday. + * UI/SOGoUI/UIxComponent.m ([UIxComponent -applicationPath]): returns the path to the application if the clientObject is not a SOGoObject. diff --git a/SoObjects/SOGo/SOGoWebAuthenticator.m b/SoObjects/SOGo/SOGoWebAuthenticator.m index 7692c2396..36a962826 100644 --- a/SoObjects/SOGo/SOGoWebAuthenticator.m +++ b/SoObjects/SOGo/SOGoWebAuthenticator.m @@ -21,14 +21,17 @@ */ #import +#import #import #import #import #import #import +#import #import #import +#import #import #import @@ -115,16 +118,47 @@ return [SOGoUser userWithLogin: login roles: roles]; } +- (WOResponse *) preprocessCredentialsInContext: (WOContext *) context +{ + /* + This is called by SoObjectRequestHandler prior doing any significant + processing to allow the authenticator to reject invalid requests. + */ + WOResponse *response; + NSString *auth; + + auth = [[context request] + cookieValueForKey: [self cookieNameInContext:context]]; + if ([auth isEqualToString: @"discard"]) + { + [context setObject: [NSArray arrayWithObject: SoRole_Anonymous] + forKey: @"SoAuthenticatedRoles"]; + response = nil; + } + else + response = [super preprocessCredentialsInContext: context]; + + return response; +} + - (void) setupAuthFailResponse: (WOResponse *) response withReason: (NSString *) reason inContext: (WOContext *) context { WOComponent *page; + WOCookie *authCookie; + NSCalendarDate *date; page = [[WOApplication application] pageWithName: @"SOGoRootPage" forRequest: [context request]]; [[SoDefaultRenderer sharedRenderer] renderObject: page inContext: context]; + authCookie = [WOCookie cookieWithName: [self cookieNameInContext: context] + value: @"discard"]; + [authCookie setPath: @"/"]; + date = [NSCalendarDate calendarDate]; + [authCookie setExpires: [date yesterday]]; + [response addCookie: authCookie]; } @end /* SOGoWebAuthenticator */