New domain preference: SOGoIMAPCASServiceName

Set this to the service name expected by the CAS server if it differs
from SOGoIMAPServer. This is useful to request a CAS ticket for service
imap://imap.domain.com while connecting through imapproxy on imap://127.0.0.1:1143

SOGoDAVAuthenticator is not updated since it doesn't really use the imap code.
pull/12/head
Jean Raby 2013-06-18 16:36:11 -04:00
parent f24e3a0a31
commit 0fb006c19f
3 changed files with 19 additions and 7 deletions

View File

@ -43,6 +43,7 @@
- (NSString *) mailDomain;
- (NSString *) imapServer;
- (NSString *) sieveServer;
- (NSString *) imapCASServiceName;
- (NSString *) imapAclStyle;
- (NSString *) imapAclGroupIdPrefix;
- (NSString *) imapFolderSeparator;

View File

@ -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
{

View File

@ -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,13 +284,18 @@
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];