Merge branch 'fix/cas-service-names'

This commit is contained in:
Jean Raby
2013-06-18 16:44:05 -04:00
5 changed files with 39 additions and 23 deletions
+10 -8
View File
@@ -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];
}
+1
View File
@@ -43,6 +43,7 @@
- (NSString *) mailDomain;
- (NSString *) imapServer;
- (NSString *) sieveServer;
- (NSString *) imapCASServiceName;
- (NSString *) imapAclStyle;
- (NSString *) imapAclGroupIdPrefix;
- (NSString *) imapFolderSeparator;
+5
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
{
+1 -1
View File
@@ -49,7 +49,7 @@
}
- (BOOL) checkLogin: (NSString *) _login
password: (NSString *) _pwd
password: (NSString *) _pwd
{
return YES;
}
+22 -14
View File
@@ -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;