Patched version of the super.autoLogin with a time-independent equality check for the token validation
778324
private String findRememberMeCookieValue(HttpServletRequest request, HttpServletResponse response) {
        Cookie[] cookies = request.getCookies();

        if ((cookies == null) || (cookies.length == 0)) {
            return null;
        }

        for (Cookie cookie : cookies) {
            if (ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE_KEY.equals(cookie.getName())) {
                return cookie.getValue();
            }
        }

        return null;
    }
424752
def runner_check(self, auth_list, fun, args):
        '''
        
        '''
        return self.spec_check(auth_list, fun, args, 'runner')
68178
function Verifier(givenMasterKey) {
  var masterKey = givenMasterKey || MASTER_KEY;
  if (!masterKey) {
    throw new errors.ValidationFailed('invalid master key');
  }
  this.masterKey = base64url.toBuffer(masterKey);
}
46386
function tokenizer(input) {
  const topLevelTokens = getTopLevelTokens();

  const length = input.length;

  const output = [];

  let cursor = 0;
  let lastBreak = 0;

  while (cursor < length) {
    const slice = input.slice(cursor);
    const found = matchPattern(topLevelTokens, slice, false);

    if (found && input[cursor - 1] === '\\') {
      const text = input.slice(lastBreak, cursor - 1);
      if (text) {
        output.push(new Text(text));
      }

      const escapedText = found[1][0];
      output.push(new Text(escapedText));

      cursor += escapedText.length;
      lastBreak = cursor;
    } else if (found) {
      const [Tok, matches] = found;

      const text = input.slice(lastBreak, cursor);
      if (text) {
        output.push(new Text(text));
      }
      output.push(new Tok(...matches));

      cursor += matches[0].length;
      lastBreak = cursor;
    } else {
      cursor += 1;
    }
  }
  const text = input.slice(lastBreak, cursor);
  if (text) {
    output.push(new Text(text));
  }

  // if there are more closes than opens
  // intelligently remove extra ones
  return removeExtraCloses(output);
}
830875
function validateCurlyBeforeKeyword(curlyToken) {
         const keywordToken = sourceCode.getTokenAfter(curlyToken);

         if (style === '1tbs' && !astUtils.isTokenOnSameLine(curlyToken, keywordToken)) {
            context.report({
               node: curlyToken,
               messageId: 'nextLineClose',
               fix: removeNewlineBetween(curlyToken, keywordToken),
            });
         }

         if (style !== '1tbs' && astUtils.isTokenOnSameLine(curlyToken, keywordToken)) {
            context.report({
               node: curlyToken,
               messageId: 'sameLineClose',
               fix: (fixer) => fixer.insertTextAfter(curlyToken, '\n'),
            });
         }
      }
540912
def authenticated(self, user_token, **validation_context):
        
        token = self.token_storage.get(user_token)
        if token and token.validate(user_token, **validation_context):
            return True

        return False
704006
def validate(config):
    '''
    
    '''

    VALID_MASK = [
        'access',
        'attrib',
        'close_nowrite',
        'close_write',
        'create',
        'delete',
        'delete_self',
        'excl_unlink',
        'ignored',
        'modify',
        'moved_from',
        'moved_to',
        'move_self',
        'oneshot',
        'onlydir',
        'open',
        'unmount'
    ]

    # Configuration for inotify beacon should be a dict of dicts
    if not isinstance(config, list):
        return False, 'Configuration for inotify beacon must be a list.'
    else:
        _config = {}
        list(map(_config.update, config))

        if 'files' not in _config:
            return False, 'Configuration for inotify beacon must include files.'
        else:
            for path in _config.get('files'):

                if not isinstance(_config['files'][path], dict):
                    return False, ('Configuration for inotify beacon must '
                                   'be a list of dictionaries.')
                else:
                    if not any(j in ['mask',
                                     'recurse',
                                     'auto_add'] for j in _config['files'][path]):
                        return False, ('Configuration for inotify beacon must '
                                       'contain mask, recurse or auto_add items.')

                    if 'auto_add' in _config['files'][path]:
                        if not isinstance(_config['files'][path]['auto_add'], bool):
                            return False, ('Configuration for inotify beacon '
                                           'auto_add must be boolean.')

                    if 'recurse' in _config['files'][path]:
                        if not isinstance(_config['files'][path]['recurse'], bool):
                            return False, ('Configuration for inotify beacon '
                                           'recurse must be boolean.')

                    if 'mask' in _config['files'][path]:
                        if not isinstance(_config['files'][path]['mask'], list):
                            return False, ('Configuration for inotify beacon '
                                           'mask must be list.')
                        for mask in _config['files'][path]['mask']:
                            if mask not in VALID_MASK:
                                return False, ('Configuration for inotify beacon '
                                               'invalid mask option {0}.'.format(mask))
    return True, 'Valid beacon configuration'
1210498
def default_login_checker(user):
    
    username = user.get('username')
    password = user.get('password')
    the_username = os.environ.get(
        'SIMPLELOGIN_USERNAME',
        current_app.config.get('SIMPLELOGIN_USERNAME', 'admin')
    )
    the_password = os.environ.get(
        'SIMPLELOGIN_PASSWORD',
        current_app.config.get('SIMPLELOGIN_PASSWORD', 'secret')
    )
    if username == the_username and password == the_password:
        return True
    return False
939709
def _autocomplete(client, url_part, input_text, session_token=None,
                  offset=None, location=None, radius=None, language=None,
                  types=None, components=None, strict_bounds=False):
    

    params = {"input": input_text}

    if session_token:
        params["sessiontoken"] = session_token
    if offset:
        params["offset"] = offset
    if location:
        params["location"] = convert.latlng(location)
    if radius:
        params["radius"] = radius
    if language:
        params["language"] = language
    if types:
        params["types"] = types
    if components:
        if len(components) != 1 or list(components.keys())[0] != "country":
            raise ValueError("Only country components are supported")
        params["components"] = convert.components(components)
    if strict_bounds:
        params["strictbounds"] = "true"

    url = "/maps/api/place/%sautocomplete/json" % url_part
    return client._request(url, params).get("predictions", [])
1355185
protected void initLoginConfig(XmlParser.Node node)
    {
        XmlParser.Node method=node.get("auth-method");
        FormAuthenticator _formAuthenticator=null;
        if(method!=null)
        {
            Authenticator authenticator=null;
            String m=method.toString(false,true);
            if(SecurityConstraint.__FORM_AUTH.equals(m))
                authenticator=_formAuthenticator=new FormAuthenticator();
            else if(SecurityConstraint.__BASIC_AUTH.equals(m))
                authenticator=new BasicAuthenticator();
            else if(SecurityConstraint.__DIGEST_AUTH.equals(m))
                authenticator=new DigestAuthenticator();
            else if(SecurityConstraint.__CERT_AUTH.equals(m))
                authenticator=new ClientCertAuthenticator();
            else if(SecurityConstraint.__CERT_AUTH2.equals(m))
                authenticator=new ClientCertAuthenticator();
            else
                log.warn("UNKNOWN AUTH METHOD: "+m);
            getWebApplicationContext().setAuthenticator(authenticator);
        }
        XmlParser.Node name=node.get("realm-name");
        if(name!=null)
            getWebApplicationContext().setRealmName(name.toString(false,true));
        XmlParser.Node formConfig=node.get("form-login-config");
        if(formConfig!=null)
        {
            if(_formAuthenticator==null)
                log.warn("FORM Authentication miss-configured");
            else
            {
                XmlParser.Node loginPage=formConfig.get("form-login-page");
                if(loginPage!=null)
                    _formAuthenticator.setLoginPage(loginPage.toString(false,true));
                XmlParser.Node errorPage=formConfig.get("form-error-page");
                if(errorPage!=null)
                {
                    String ep=errorPage.toString(false,true);
                    _formAuthenticator.setErrorPage(ep);
                }
            }
        }
    }
124789
private boolean loginInternal(String nic, String password, int timeInSec) throws IOException {
		// Due to per IP login rate limiting, we synchronize this part of the code.
		// if multiple IP available, it can be sync on public IP based token
		synchronized (ApiOvhCore.class) {
			String oldCK = config.getConsumerKey(nic);
			if (oldCK != null && _consumerKey != null && !oldCK.equals(_consumerKey)) {
				// a new CK is available try it first.
				_consumerKey = oldCK;
				return true;
			}
			OvhCredential token = requestToken(null);
			log.info("Generating a new ConsumerKey as appKey: {} for account {} valid for {} sec, validationUrl:{}",
					this.config.getApplicationKey(), nic, timeInSec, token.validationUrl);

			Document doc = Jsoup.connect(token.validationUrl).get();
			String html = doc.toString();
			if (html.contains("Too much requests"))
				return false;
			// <input type="hidden" name="sT" id="sT" value="XXXXX">
			Element st = doc.getElementById("sT");
			FormElement form = null;
			// get Parent Form
			for (Element elm : st.parents()) {
				// "form".equalsIgnoreCase(elm.tagName())
				if (elm instanceof FormElement) {
					form = (FormElement) elm;
					break;
				}
			}
			Elements inputs = form.select("input");
			Connection validForm = Jsoup.connect(token.validationUrl);
			validForm.followRedirects(false);
			// fill user and password field
			for (Element e : inputs) {
				String name = e.attr("name");
				String value = e.attr("value");
				String type = e.attr("type");
				if ("text".equals(type))
					value = nic;
				else if ("password".equals(type))
					value = password;
				validForm.data(name, value);
			}
			// set Expiration Date
			validForm.data("duration", Integer.toString(timeInSec));
			Document doc2 = validForm.post();
			Elements p = doc2.select("p");
			String pText = p.text();
			if ("The document has moved here.".equals(pText)) {
				log.info("a new consumerKey had been issued for {}", nic);
				this.setCK(nic, token.consumerKey);
				return true;
			}
			if ("Your token is now valid, you can use it in your application".equals(pText)) {
				log.info("a new consumerKey had been issued for {}", nic);
				this.setCK(nic, token.consumerKey);
				return true;
			}
			String error = doc2.select("div.error").text();
			if (error != null && error.length() > 0)
				log.error("Login {} Error:{}", nic, error);
			else {
				String body = doc2.toString();
				if (body.contains("Too much requests. Please retry in 3 seconds. ")) {
					log.error("Too much requests, block all connexion for 3sec, Retry later to connect {}", nic);
					ApiOvhUtils.sleep(3000);
				} else {
					log.error("Unknown Error connecting to {} in body:{}", nic, body);
				}
			}
			return false;
		}
	}
1334494
private void checkAst(Node externs, Node root) {
    astValidator.validateCodeRoot(externs);
    astValidator.validateCodeRoot(root);
  }
30833
def _auto_positive_symbol(tokens, local_dict, global_dict):
    
    result = []

    tokens.append((None, None))  # so zip traverses all tokens
    for tok, nextTok in zip(tokens, tokens[1:]):
        tokNum, tokVal = tok
        nextTokNum, nextTokVal = nextTok
        if tokNum == token.NAME:
            name = tokVal
            if name in global_dict:
                obj = global_dict[name]
                if isinstance(obj, (Basic, type)) or callable(obj):
                    result.append((token.NAME, name))
                    continue

            # try to resolve known alternative unit name
            try:
                used_name = inv_name_alternatives[str(name)]
            except KeyError:
                # if we don't know this name it's a user-defined unit name
                # so we should create a new symbol for it
                used_name = str(name)

            result.extend(
                [
                    (token.NAME, "Symbol"),
                    (token.OP, "("),
                    (token.NAME, repr(used_name)),
                    (token.OP, ","),
                    (token.NAME, "positive"),
                    (token.OP, "="),
                    (token.NAME, "True"),
                    (token.OP, ")"),
                ]
            )
        else:
            result.append((tokNum, tokVal))

    return result
506525
function ensureLogin(callback) {
		exec('"' + getTitaniumPath() + '" status -o json', function(err, stdout, stderr) {
			if (err) { return callback(err); }
			if (!JSON.parse(stdout).loggedIn) {
				grunt.fail.fatal([
					'You must be logged in to use grunt-titanium. Use `titanium login`.'
				]);
			}
			return callback();
		});
	}
372632
private boolean isValidSystemCredentials(String userid, String password) {
        String superUser = ServerParams.instance().getModuleParamString("DoradusServer", "super_user");
        String superPassword = ServerParams.instance().getModuleParamString("DoradusServer", "super_password");
        return Utils.isEmpty(superUser) ||
               Utils.isEmpty(superPassword) ||
               (superUser.equals(userid) && superPassword.equals(password));
    }
875394
def login_required(f):
    '''
    
    '''
    def _wrapper(self, *args, **kwargs):
        '''
        Function to be applied on top of all decorated methods
        '''
        if self._token_age:
            timediff = self._token_age - datetime.datetime.now()
            if timediff.total_seconds() / 60 > TOKEN_TIMEOUT:
                self.logout()  # Log out to invalidate previous token
                self.login()  # Request new token
        else:  # haven't logged in yet
            self.login()
        return f(self, *args, **kwargs)
    return _wrapper
444567
private Tuple2<List<KeyedStateHandle>, List<KeyedStateHandle>> reAssignSubKeyedStates(
			OperatorState operatorState,
			List<KeyGroupRange> keyGroupPartitions,
			int subTaskIndex,
			int newParallelism,
			int oldParallelism) {

		List<KeyedStateHandle> subManagedKeyedState;
		List<KeyedStateHandle> subRawKeyedState;

		if (newParallelism == oldParallelism) {
			if (operatorState.getState(subTaskIndex) != null) {
				subManagedKeyedState = operatorState.getState(subTaskIndex).getManagedKeyedState().asList();
				subRawKeyedState = operatorState.getState(subTaskIndex).getRawKeyedState().asList();
			} else {
				subManagedKeyedState = Collections.emptyList();
				subRawKeyedState = Collections.emptyList();
			}
		} else {
			subManagedKeyedState = getManagedKeyedStateHandles(operatorState, keyGroupPartitions.get(subTaskIndex));
			subRawKeyedState = getRawKeyedStateHandles(operatorState, keyGroupPartitions.get(subTaskIndex));
		}

		if (subManagedKeyedState.isEmpty() && subRawKeyedState.isEmpty()) {
			return new Tuple2<>(Collections.emptyList(), Collections.emptyList());
		} else {
			return new Tuple2<>(subManagedKeyedState, subRawKeyedState);
		}
	}