<commit_before># Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.

"""Integration with webapp2."""

# Disable 'Method could be a function.'
# pylint: disable=R0201

import logging
import webapp2

from google.appengine.api import oauth
from google.appengine.api import users

from . import api
from . import model
from . import tokens

# Part of public API of 'auth' component, exposed by this module.
__all__ = [
  'AuthenticatingHandler',
  'configure',
  'cookie_authentication',
  'get_authenticated_routes',
  'oauth_authentication',
  'service_to_service_authentication',
]


# Global list of authentication functions to use to authenticate all
# requests. Used by AuthenticatingHandler. Initialized in 'configure'.
_auth_methods = ()


class XSRFToken(tokens.TokenKind):
  """XSRF token parameters."""
  expiration_sec = 2 * 3600
  secret_key = api.SecretKey('xsrf_token', scope='local')
  version = 1


class AuthenticatingHandlerMetaclass(type):
  """Ensures that 'get', 'post', etc. are marked with @require or @public."""

  def __new__(mcs, name, bases, attributes):
    for method in webapp2.WSGIApplication.allowed_methods:
      func = attributes.get(method.lower())
      if func and not api.is_decorated(func):<commit_msg>Bump XSRF token expiration timeout from 2h to 4h.<commit_after># Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.

"""Integration with webapp2."""

# Disable 'Method could be a function.'
# pylint: disable=R0201

import logging
import webapp2

from google.appengine.api import oauth
from google.appengine.api import users

from . import api
from . import model
from . import tokens

# Part of public API of 'auth' component, exposed by this module.
__all__ = [
  'AuthenticatingHandler',
  'configure',
  'cookie_authentication',
  'get_authenticated_routes',
  'oauth_authentication',
  'service_to_service_authentication',
]


# Global list of authentication functions to use to authenticate all
# requests. Used by AuthenticatingHandler. Initialized in 'configure'.
_auth_methods = ()


class XSRFToken(tokens.TokenKind):
  """XSRF token parameters."""
  expiration_sec = 4 * 3600
  secret_key = api.SecretKey('xsrf_token', scope='local')
  version = 1


class AuthenticatingHandlerMetaclass(type):
  """Ensures that 'get', 'post', etc. are marked with @require or @public."""

  def __new__(mcs, name, bases, attributes):
    for method in webapp2.WSGIApplication.allowed_methods:
      func = attributes.get(method.lower())
      if func and not api.is_decorated(func):
{'fraction_non_alphanumeric': 0.09518599562363239, 'fraction_numerical': 0.014587892049598834, 'mean_word_length': 4.6440329218107, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2119612', 'n_tokens_mistral': 847, 'n_tokens_neox': 809, 'n_words': 285}