Monotone-Parent: 47be4cd66ca07d4558d608a37376c91af1d0b863

Monotone-Revision: 85e21021232d18a3c2b1b1d16cf6d52237236f29

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-06-10T21:29:55
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-06-10 21:29:55 +00:00
parent 3f43e0b56e
commit cc7cb9f2bb
5 changed files with 35 additions and 11 deletions

View File

@ -1,5 +1,11 @@
2010-06-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoCASSession.m
(+CASSessionWithTicket:fromProxy:): added a new "fromProxy" parameter.
(+CASSessionWithIdentifier:fromProxy:): idem.
(-fetchData): if the session is used by a proxy client, we invoke
"proxyValidate" rather than "serviceValidate".
* SoObjects/SOGo/SOGoDAVAuthenticator.m (-userInContext:):
reorganized method.

View File

@ -34,6 +34,7 @@
@interface SOGoCASSession : NSObject
{
NSString *ticket;
BOOL ticketFromProxy;
NSString *login;
NSString *pgt;
NSString *identifier;
@ -45,12 +46,13 @@
+ (NSString *) CASURLWithAction: (NSString *) casAction
andParameters: (NSDictionary *) parameters;
+ (SOGoCASSession *) CASSessionWithTicket: (NSString *) newTicket;
+ (SOGoCASSession *) CASSessionWithIdentifier: (NSString *) newIdentifier;
+ (SOGoCASSession *) CASSessionWithTicket: (NSString *) newTicket
fromProxy: (BOOL) fromProxy;
+ (SOGoCASSession *) CASSessionWithIdentifier: (NSString *) newIdentifier
fromProxy: (BOOL) fromProxy;
- (NSString *) identifier;
- (void) setTicket: (NSString *) newTicket;
- (NSString *) ticket;
- (NSString *) login;

View File

@ -43,6 +43,13 @@
#import "SOGoCASSession.h"
@interface SOGoCASSession (SOGoPrivate)
- (void) setTicket: (NSString *) newTicket
fromProxy: (BOOL) fromProxy;
@end
@implementation SOGoCASSession
+ (NSString *) CASURLWithAction: (NSString *) casAction
@ -68,6 +75,7 @@
}
+ (SOGoCASSession *) CASSessionWithTicket: (NSString *) newTicket
fromProxy: (BOOL) fromProxy
{
SOGoCASSession *newSession;
@ -75,7 +83,8 @@
{
newSession = [self new];
[newSession autorelease];
[newSession setTicket: newTicket];
[newSession setTicket: newTicket
fromProxy: fromProxy];
}
else
newSession = nil;
@ -84,6 +93,7 @@
}
+ (SOGoCASSession *) CASSessionWithIdentifier: (NSString *) newIdentifier
fromProxy: (BOOL) fromProxy
{
SOGoCASSession *session;
SOGoCache *cache;
@ -91,7 +101,7 @@
cache = [SOGoCache sharedCache];
casTicket = [cache CASTicketFromIdentifier: newIdentifier];
session = [self CASSessionWithTicket: casTicket];
session = [self CASSessionWithTicket: casTicket fromProxy: fromProxy];
return session;
}
@ -101,6 +111,7 @@
if ((self = [super init]))
{
ticket = nil;
ticketFromProxy = NO;
login = nil;
pgt = nil;
identifier = nil;
@ -163,8 +174,10 @@
}
- (void) setTicket: (NSString *) newTicket
fromProxy: (BOOL) fromProxy
{
ASSIGN (ticket, newTicket);
ticketFromProxy = fromProxy;
[self _loadSessionFromCache];
}
@ -355,8 +368,7 @@
application = [WOApplication application];
request = [[application context] request];
pgtURL = [NSString stringWithFormat:
@"https://%@/%@/casProxy",
pgtURL = [NSString stringWithFormat: @"https://%@/%@/casProxy",
[soURL host], [request applicationName]];
return pgtURL;
@ -375,7 +387,9 @@
ticket, @"ticket", serviceURL, @"service",
[self _pgtUrlFromURL: soURL], @"pgtUrl",
nil];
[self _performCASRequestWithAction: @"serviceValidate"
[self _performCASRequestWithAction: (ticketFromProxy
? @"proxyValidate"
: @"serviceValidate")
andParameters: params];
identifier = [SOGoObject globallyUniqueObjectId];
[identifier retain];

View File

@ -84,7 +84,7 @@
if ([[sd authenticationType] isEqualToString: @"cas"])
{
session = [SOGoCASSession CASSessionWithIdentifier: _pwd];
session = [SOGoCASSession CASSessionWithIdentifier: _pwd fromProxy: NO];
if (session)
rc = [[session login] isEqualToString: _login];
else
@ -152,7 +152,8 @@
sd = [SOGoSystemDefaults sharedSystemDefaults];
if ([[sd authenticationType] isEqualToString: @"cas"])
{
session = [SOGoCASSession CASSessionWithIdentifier: password];
session = [SOGoCASSession CASSessionWithIdentifier: password
fromProxy: NO];
service = [NSString stringWithFormat: @"imap://%@", imapServer];
if (renew)
[session invalidateTicketForService: service];

View File

@ -248,7 +248,8 @@
ticket = [rq formValueForKey: @"ticket"];
if ([ticket length])
{
casSession = [SOGoCASSession CASSessionWithTicket: ticket];
casSession = [SOGoCASSession CASSessionWithTicket: ticket
fromProxy: NO];
login = [casSession login];
if ([login length])
{