Don't use user/password cache from the login page
The idea is to always use memcached for credentials to avoid hitting the authentication backend on every click but to check with the auth backend for every login requests. This should fix #2169 While there, fix whitespace (killtab)pull/10/head
parent
488a76c5e3
commit
451c82c815
|
@ -88,6 +88,14 @@
|
||||||
expire: (int *) _expire
|
expire: (int *) _expire
|
||||||
grace: (int *) _grace;
|
grace: (int *) _grace;
|
||||||
|
|
||||||
|
- (BOOL) checkLogin: (NSString *) _login
|
||||||
|
password: (NSString *) _pwd
|
||||||
|
domain: (NSString **) _domain
|
||||||
|
perr: (SOGoPasswordPolicyError *) _perr
|
||||||
|
expire: (int *) _expire
|
||||||
|
grace: (int *) _grace
|
||||||
|
useCache: (BOOL) _useCache;
|
||||||
|
|
||||||
- (BOOL) changePasswordForLogin: (NSString *) login
|
- (BOOL) changePasswordForLogin: (NSString *) login
|
||||||
inDomain: (NSString *) domain
|
inDomain: (NSString *) domain
|
||||||
oldPassword: (NSString *) oldPassword
|
oldPassword: (NSString *) oldPassword
|
||||||
|
|
|
@ -453,6 +453,23 @@ static Class NSNullK;
|
||||||
perr: (SOGoPasswordPolicyError *) _perr
|
perr: (SOGoPasswordPolicyError *) _perr
|
||||||
expire: (int *) _expire
|
expire: (int *) _expire
|
||||||
grace: (int *) _grace
|
grace: (int *) _grace
|
||||||
|
{
|
||||||
|
return [self checkLogin: _login
|
||||||
|
password: _pwd
|
||||||
|
domain: _domain
|
||||||
|
perr: _perr
|
||||||
|
expire: _expire
|
||||||
|
grace: _grace
|
||||||
|
useCache: YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) checkLogin: (NSString *) _login
|
||||||
|
password: (NSString *) _pwd
|
||||||
|
domain: (NSString **) _domain
|
||||||
|
perr: (SOGoPasswordPolicyError *) _perr
|
||||||
|
expire: (int *) _expire
|
||||||
|
grace: (int *) _grace
|
||||||
|
useCache: (BOOL) useCache
|
||||||
{
|
{
|
||||||
NSString *dictPassword, *username, *jsonUser;
|
NSString *dictPassword, *username, *jsonUser;
|
||||||
NSMutableDictionary *currentUser;
|
NSMutableDictionary *currentUser;
|
||||||
|
@ -468,7 +485,7 @@ static Class NSNullK;
|
||||||
jsonUser = [[SOGoCache sharedCache] userAttributesForLogin: username];
|
jsonUser = [[SOGoCache sharedCache] userAttributesForLogin: username];
|
||||||
currentUser = [jsonUser objectFromJSONString];
|
currentUser = [jsonUser objectFromJSONString];
|
||||||
dictPassword = [currentUser objectForKey: @"password"];
|
dictPassword = [currentUser objectForKey: @"password"];
|
||||||
if (currentUser && dictPassword)
|
if (useCache && currentUser && dictPassword)
|
||||||
{
|
{
|
||||||
checkOK = ([dictPassword isEqualToString: [_pwd asSHA1String]]);
|
checkOK = ([dictPassword isEqualToString: [_pwd asSHA1String]]);
|
||||||
//NSLog(@"Password cache hit for user %@", _login);
|
//NSLog(@"Password cache hit for user %@", _login);
|
||||||
|
|
|
@ -48,6 +48,14 @@
|
||||||
expire: (int *) _expire
|
expire: (int *) _expire
|
||||||
grace: (int *) _grace;
|
grace: (int *) _grace;
|
||||||
|
|
||||||
|
- (BOOL) checkLogin: (NSString *) _login
|
||||||
|
password: (NSString *) _pwd
|
||||||
|
domain: (NSString **) _domain
|
||||||
|
perr: (SOGoPasswordPolicyError *) _perr
|
||||||
|
expire: (int *) _expire
|
||||||
|
grace: (int *) _grace
|
||||||
|
useCache: (BOOL) useCache;
|
||||||
|
|
||||||
- (WOCookie *) cookieWithUsername: (NSString *) username
|
- (WOCookie *) cookieWithUsername: (NSString *) username
|
||||||
andPassword: (NSString *) password
|
andPassword: (NSString *) password
|
||||||
inContext: (WOContext *) context;
|
inContext: (WOContext *) context;
|
||||||
|
|
|
@ -109,6 +109,23 @@
|
||||||
perr: (SOGoPasswordPolicyError *) _perr
|
perr: (SOGoPasswordPolicyError *) _perr
|
||||||
expire: (int *) _expire
|
expire: (int *) _expire
|
||||||
grace: (int *) _grace
|
grace: (int *) _grace
|
||||||
|
{
|
||||||
|
return [self checkLogin: _login
|
||||||
|
password: _pwd
|
||||||
|
domain: _domain
|
||||||
|
perr: _perr
|
||||||
|
expire: _expire
|
||||||
|
grace: _grace
|
||||||
|
useCache: YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) checkLogin: (NSString *) _login
|
||||||
|
password: (NSString *) _pwd
|
||||||
|
domain: (NSString **) _domain
|
||||||
|
perr: (SOGoPasswordPolicyError *) _perr
|
||||||
|
expire: (int *) _expire
|
||||||
|
grace: (int *) _grace
|
||||||
|
useCache: (BOOL) _useCache
|
||||||
{
|
{
|
||||||
SOGoCASSession *session;
|
SOGoCASSession *session;
|
||||||
SOGoSystemDefaults *sd;
|
SOGoSystemDefaults *sd;
|
||||||
|
@ -144,7 +161,8 @@
|
||||||
domain: _domain
|
domain: _domain
|
||||||
perr: _perr
|
perr: _perr
|
||||||
expire: _expire
|
expire: _expire
|
||||||
grace: _grace];
|
grace: _grace
|
||||||
|
useCache: _useCache];
|
||||||
|
|
||||||
//[self logWithFormat: @"Checked login with ppolicy enabled: %d %d %d", *_perr, *_expire, *_grace];
|
//[self logWithFormat: @"Checked login with ppolicy enabled: %d %d %d", *_perr, *_expire, *_grace];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue