diff --git a/SoObjects/SOGo/SOGoDAVAuthenticator.m b/SoObjects/SOGo/SOGoDAVAuthenticator.m index 0755c223c..ad3bb7bce 100644 --- a/SoObjects/SOGo/SOGoDAVAuthenticator.m +++ b/SoObjects/SOGo/SOGoDAVAuthenticator.m @@ -51,7 +51,7 @@ } - (BOOL) checkLogin: (NSString *) _login - password: (NSString *) _pwd + password: (NSString *) _pwd { NSString *domain; SOGoSystemDefaults *sd; @@ -66,7 +66,7 @@ checkLogin: [_login stringByReplacingString: @"%40" withString: @"@"] password: _pwd - domain: &domain + domain: &domain perr: &perr expire: &expire grace: &grace] @@ -99,7 +99,7 @@ { creds = [self parseCredentials: auth]; if ([creds count] > 1) - password = [creds objectAtIndex: 1]; + password = [creds objectAtIndex: 1]; } return password; @@ -122,17 +122,19 @@ session = [SOGoCASSession CASSessionWithTicket: password fromProxy: YES]; - // We must NOT assume the scheme exists - scheme = [server scheme]; + // We must NOT assume the scheme exists + scheme = [server scheme]; - if (!scheme) - scheme = @"imap"; + if (!scheme) + scheme = @"imap"; - service = [NSString stringWithFormat: @"%@://%@", scheme, [server host]]; + service = [NSString stringWithFormat: @"%@://%@", scheme, [server host]]; if (renew) [session invalidateTicketForService: service]; + password = [session ticketForService: service]; + if ([password length] || renew) [session updateCache]; } diff --git a/SoObjects/SOGo/SOGoDomainDefaults.h b/SoObjects/SOGo/SOGoDomainDefaults.h index 557c86002..694714ae6 100644 --- a/SoObjects/SOGo/SOGoDomainDefaults.h +++ b/SoObjects/SOGo/SOGoDomainDefaults.h @@ -43,6 +43,7 @@ - (NSString *) mailDomain; - (NSString *) imapServer; - (NSString *) sieveServer; +- (NSString *) imapCASServiceName; - (NSString *) imapAclStyle; - (NSString *) imapAclGroupIdPrefix; - (NSString *) imapFolderSeparator; diff --git a/SoObjects/SOGo/SOGoDomainDefaults.m b/SoObjects/SOGo/SOGoDomainDefaults.m index 9a4747eca..98e675ddf 100644 --- a/SoObjects/SOGo/SOGoDomainDefaults.m +++ b/SoObjects/SOGo/SOGoDomainDefaults.m @@ -123,6 +123,11 @@ return [self stringForKey: @"SOGoSieveServer"]; } +- (NSString *) imapCASServiceName +{ + return [self objectForKey: @"SOGoIMAPCASServiceName"]; +} + #warning should be removed when we make use of imap namespace - (NSString *) imapAclStyle { diff --git a/SoObjects/SOGo/SOGoProxyAuthenticator.m b/SoObjects/SOGo/SOGoProxyAuthenticator.m index 08825fe98..7b1e96bb2 100644 --- a/SoObjects/SOGo/SOGoProxyAuthenticator.m +++ b/SoObjects/SOGo/SOGoProxyAuthenticator.m @@ -49,7 +49,7 @@ } - (BOOL) checkLogin: (NSString *) _login - password: (NSString *) _pwd + password: (NSString *) _pwd { return YES; } diff --git a/SoObjects/SOGo/SOGoWebAuthenticator.m b/SoObjects/SOGo/SOGoWebAuthenticator.m index 639ca4ec0..c60ac7732 100644 --- a/SoObjects/SOGo/SOGoWebAuthenticator.m +++ b/SoObjects/SOGo/SOGoWebAuthenticator.m @@ -74,7 +74,7 @@ } - (BOOL) checkLogin: (NSString *) _login - password: (NSString *) _pwd + password: (NSString *) _pwd { NSString *username, *password, *domain, *value; SOGoPasswordPolicyError perr; @@ -168,7 +168,7 @@ perr: _perr expire: _expire grace: _grace - useCache: _useCache]; + useCache: _useCache]; //[self logWithFormat: @"Checked login with ppolicy enabled: %d %d %d", *_perr, *_expire, *_grace]; @@ -269,12 +269,13 @@ forceRenew: (BOOL) renew { NSString *authType, *password; + SOGoSystemDefaults *sd; password = [self passwordInContext: context]; if ([password length]) { - authType = [[SOGoSystemDefaults sharedSystemDefaults] - authenticationType]; + sd = [SOGoSystemDefaults sharedSystemDefaults]; + authType = [sd authenticationType]; if ([authType isEqualToString: @"cas"]) { SOGoCASSession *session; @@ -283,17 +284,24 @@ session = [SOGoCASSession CASSessionWithIdentifier: password fromProxy: NO]; - // We must NOT assume the scheme exists - scheme = [server scheme]; + service = [sd imapCASServiceName]; // try configured service first + if (!service) + { + // We must NOT assume the scheme exists + scheme = [server scheme]; - if (!scheme) - scheme = @"imap"; + if (!scheme) + scheme = @"imap"; - service = [NSString stringWithFormat: @"%@://%@", scheme, [server host]]; + service = [NSString stringWithFormat: @"%@://%@", + scheme, [server host]]; + } if (renew) [session invalidateTicketForService: service]; + password = [session ticketForService: service]; + if ([password length] || renew) [session updateCache]; } @@ -322,8 +330,8 @@ /* create SOGoUser */ - (SOGoUser *) userWithLogin: (NSString *) login - andRoles: (NSArray *) roles - inContext: (WOContext *) ctx + andRoles: (NSArray *) roles + inContext: (WOContext *) ctx { /* the actual factory method */ return [SOGoUser userWithLogin: login roles: roles]; @@ -339,7 +347,7 @@ NSString *auth; auth = [[context request] - cookieValueForKey: [self cookieNameInContext:context]]; + cookieValueForKey: [self cookieNameInContext:context]]; if ([auth isEqualToString: @"discard"]) { [context setObject: [NSArray arrayWithObject: SoRole_Anonymous] @@ -353,8 +361,8 @@ } - (void) setupAuthFailResponse: (WOResponse *) response - withReason: (NSString *) reason - inContext: (WOContext *) context + withReason: (NSString *) reason + inContext: (WOContext *) context { WOComponent *page; WORequest *request;