Merge pull request #4217 from whiteinge/fix-token-auth

Fix wheel token auth by moving eauth checks below token
This commit is contained in:
Thomas S Hatch 2013-03-22 20:30:38 -07:00
commit 9d9c62d186

View File

@ -1539,18 +1539,6 @@ class ClearFuncs(object):
Send a master control function back to the wheel system
'''
# All wheel ops pass through eauth
if not 'eauth' in clear_load:
msg = ('Authentication failure of type "eauth" occurred for '
'user {0}.').format(clear_load.get('username', 'UNKNOWN'))
log.warning(msg)
return ''
if not clear_load['eauth'] in self.opts['external_auth']:
# The eauth system is not enabled, fail
msg = ('Authentication failure of type "eauth" occurred for '
'user {0}.').format(clear_load.get('username', 'UNKNOWN'))
log.warning(msg)
return ''
if 'token' in clear_load:
try:
token = self.loadauth.get_tok(clear_load['token'])
@ -1574,6 +1562,18 @@ class ClearFuncs(object):
clear_load.pop('fun'),
**clear_load)
if not 'eauth' in clear_load:
msg = ('Authentication failure of type "eauth" occurred for '
'user {0}.').format(clear_load.get('username', 'UNKNOWN'))
log.warning(msg)
return ''
if not clear_load['eauth'] in self.opts['external_auth']:
# The eauth system is not enabled, fail
msg = ('Authentication failure of type "eauth" occurred for '
'user {0}.').format(clear_load.get('username', 'UNKNOWN'))
log.warning(msg)
return ''
try:
name = self.loadauth.load_name(clear_load)
if not name in self.opts['external_auth'][clear_load['eauth']]: