mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-10 17:33:25 +00:00
Monotone-Parent: 47be4cd66ca07d4558d608a37376c91af1d0b863
Monotone-Revision: 85e21021232d18a3c2b1b1d16cf6d52237236f29 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-06-10T21:29:55 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user