def is_valid_awsume_session(awsumeSession):
"""
awsumeSession - the session to validate;
return whether or not the session is valid;
if credentials are expired, or don't exist, they're invalid;
else they are valid
"""
log.info('Checking if the session is valid')
#check if the session has an expiration
if awsumeSession.get('Expiration'):
#check if the session is expired
if awsumeSession.get('Expiration') > datetime.datetime.now().replace():
return True
log.debug('Session is expired')
return False
return False
评论列表
文章目录