Monotone-Parent: a537eafe3c9b8d1046ede59e14085496e406534c

Monotone-Revision: 2480fdc1f3b38f823b4837afc37bd69832ad93be

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-04-12T21:22:54
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-04-12 21:22:54 +00:00
parent 3418a0c7f1
commit 872edfe59b
2 changed files with 39 additions and 2 deletions
+4
View File
@@ -1,5 +1,9 @@
2010-04-12 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoProxyAuthenticator.m (-passwordInContext:):
use the "authorization" header to determine the password of the
user, if any.
* SoObjects/Appointments/SOGoAptMailReceipt.m (-getSubject)
(-getBody): taken methods from old version of
SOGoAptMailNotification, to avoid a crash regarding a lock of
+35 -2
View File
@@ -28,6 +28,7 @@
#import <NGObjWeb/WORequest.h>
#import <NGObjWeb/WOResponse.h>
#import <NGExtensions/NGBase64Coding.h>
#import <NGExtensions/NSObject+Logs.h>
#import "SOGoPermissions.h"
@@ -100,14 +101,46 @@
- (NSString *) passwordInContext: (WOContext *) context
{
return @"";
NSString *password, *authType, *authorization, *pair, *pairStart;
WORequest *rq;
password = @"";
rq = [context request];
authType = [rq headerForKey: @"x-webobjects-auth-type"];
if ([authType isEqualToString: @"Basic"])
{
authorization = [rq headerForKey: @"authorization"];
if ([authorization hasPrefix: @"Basic "])
{
pair = [[authorization substringFromIndex: 6]
stringByDecodingBase64];
pairStart = [NSString stringWithFormat: @"%@:",
[self checkCredentialsInContext: context]];
if ([pair hasPrefix: pairStart])
password = [pair substringFromIndex: [pairStart length]];
else
[self errorWithFormat: @"the username in the 'authorization'"
@" header does not have the expected value"];
}
else
[self errorWithFormat:
@"'authorization' header does not have the expected value"];
}
else if (authType)
[self errorWithFormat: @"unrecognized authentication type: '%@'",
authType];
else
[self warnWithFormat: @"no authentication type found, skipped"];
return password;
}
- (NSString *) imapPasswordInContext: (WOContext *) context
forServer: (NSString *) imapServer
forceRenew: (BOOL) renew
{
return (renew ? nil : @"");
return (renew ? nil : [self passwordInContext: context]);
}
- (WOResponse *) preprocessCredentialsInContext: (WOContext *) context