Moved INITIAL_NO_AUTH_ACTION_COUNT to settings.
This commit is contained in:
		
							parent
							
								
									95799b99bc
								
							
						
					
					
						commit
						3dd2e3a1b8
					
				@ -1,6 +1,5 @@
 | 
			
		||||
from __future__ import unicode_literals
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
from collections import defaultdict
 | 
			
		||||
import datetime
 | 
			
		||||
import json
 | 
			
		||||
@ -25,7 +24,7 @@ from werkzeug.exceptions import HTTPException
 | 
			
		||||
import boto3
 | 
			
		||||
from moto.compat import OrderedDict
 | 
			
		||||
from moto.core.utils import camelcase_to_underscores, method_names_from_class
 | 
			
		||||
 | 
			
		||||
from moto.settings import INITIAL_NO_AUTH_ACTION_COUNT
 | 
			
		||||
 | 
			
		||||
log = logging.getLogger(__name__)
 | 
			
		||||
 | 
			
		||||
@ -108,11 +107,10 @@ class _TemplateEnvironmentMixin(object):
 | 
			
		||||
 | 
			
		||||
class ActionAuthenticatorMixin(object):
 | 
			
		||||
 | 
			
		||||
    INITIAL_NO_AUTH_ACTION_COUNT = float(os.environ.get("INITIAL_NO_AUTH_ACTION_COUNT", float("inf")))
 | 
			
		||||
    request_count = 0
 | 
			
		||||
 | 
			
		||||
    def _authenticate_action(self, iam_request_cls):
 | 
			
		||||
        if ActionAuthenticatorMixin.request_count >= ActionAuthenticatorMixin.INITIAL_NO_AUTH_ACTION_COUNT:
 | 
			
		||||
        if ActionAuthenticatorMixin.request_count >= INITIAL_NO_AUTH_ACTION_COUNT:
 | 
			
		||||
            iam_request = iam_request_cls(method=self.method, path=self.path, data=self.data, headers=self.headers)
 | 
			
		||||
            iam_request.check_signature()
 | 
			
		||||
            iam_request.check_action_permitted()
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,4 @@
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
TEST_SERVER_MODE = os.environ.get('TEST_SERVER_MODE', '0').lower() == 'true'
 | 
			
		||||
INITIAL_NO_AUTH_ACTION_COUNT = float(os.environ.get('INITIAL_NO_AUTH_ACTION_COUNT', float('inf')))
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user