Example #1
0
    def __init__(
        self,
        secret,
        cookie_name='auth_tkt',
        secure=False,
        include_ip=False,
        timeout=None,
        reissue_time=None,
        max_age=None,
        http_only=False,
        path="/",
        wild_domain=True,
        hashalg=None,
        parent_domain=False,
        domain=None,
        samesite='Lax',
    ):
        if hashalg is None:
            hashalg = 'md5'
            warnings.warn(
                'The default "hashalg" is "md5" and will change to "sha512" '
                'in Pyramid 2.0. To preserve the current behavior, '
                'explicitly pass hashalg="md5".',
                DeprecationWarning,
                stacklevel=1,
            )

        serializer = SimpleSerializer()

        self.cookie_profile = CookieProfile(
            cookie_name=cookie_name,
            secure=secure,
            max_age=max_age,
            httponly=http_only,
            path=path,
            serializer=serializer,
            samesite=samesite,
        )

        self.secret = secret
        self.cookie_name = cookie_name
        self.secure = secure
        self.include_ip = include_ip
        self.timeout = timeout if timeout is None else int(timeout)
        self.reissue_time = (reissue_time
                             if reissue_time is None else int(reissue_time))
        self.max_age = max_age if max_age is None else int(max_age)
        self.wild_domain = wild_domain
        self.parent_domain = parent_domain
        self.domain = domain
        self.hashalg = hashalg
Example #2
0
    def __init__(
        self,
        secret,
        cookie_name='auth_tkt',
        secure=False,
        include_ip=False,
        timeout=None,
        reissue_time=None,
        max_age=None,
        http_only=False,
        path="/",
        wild_domain=True,
        hashalg='md5',
        parent_domain=False,
        domain=None,
        samesite='Lax',
    ):

        serializer = SimpleSerializer()

        self.cookie_profile = CookieProfile(
            cookie_name=cookie_name,
            secure=secure,
            max_age=max_age,
            httponly=http_only,
            path=path,
            serializer=serializer,
            samesite=samesite,
        )

        self.secret = secret
        self.cookie_name = cookie_name
        self.secure = secure
        self.include_ip = include_ip
        self.timeout = timeout if timeout is None else int(timeout)
        self.reissue_time = (reissue_time
                             if reissue_time is None else int(reissue_time))
        self.max_age = max_age if max_age is None else int(max_age)
        self.wild_domain = wild_domain
        self.parent_domain = parent_domain
        self.domain = domain
        self.hashalg = hashalg
Example #3
0
 def __init__(self,
              cookie_name='csrf_token',
              secure=False,
              httponly=False,
              domain=None,
              max_age=None,
              path='/',
              samesite='Lax'):
     serializer = SimpleSerializer()
     self.cookie_profile = CookieProfile(
         cookie_name=cookie_name,
         secure=secure,
         max_age=max_age,
         httponly=httponly,
         path=path,
         domains=[domain],
         serializer=serializer,
         samesite=samesite,
     )
     self.cookie_name = cookie_name
Example #4
0
    def _makeOne(self):
        from pyramid.util import SimpleSerializer

        return SimpleSerializer()