<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/paste.git/paste/auth/auth_tkt.py, branch stringio</title>
<subtitle>bitbucket.org: Obsolete (use python-packages/paste-git)
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/paste.git/'/>
<entry>
<title>auth/auth_tkt.py: enable overriding digest algorithms</title>
<updated>2012-03-05T20:14:08+00:00</updated>
<author>
<name>Jan Pokorn?</name>
<email>jpokorny@redhat.com</email>
</author>
<published>2012-03-05T20:14:08+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/paste.git/commit/?id=663ec52ddd568148e000f1e7d2ea65d2ec284dd5'/>
<id>663ec52ddd568148e000f1e7d2ea65d2ec284dd5</id>
<content type='text'>
Currently, mod_auth_tkt supports also SHA256 and SHA 512 [1],
not just plain MD5.  Quoting:

----v----
The default is MD5, which is faster, but has now been shown to be
vulnerable to collision attacks. Such attacks are not directly applicable
to mod_auth_tkt, which primarily relies on the security of the shared
secret rather than the strength of the hashing scheme. More paranoid users
will probably prefer to use one of the SHA digest types, however.

The default is likely to change in a future version, so setting the digest
type explicitly is encouraged.
----^----

Thus, enable it also in this implementation so one can optionally switch
to a stronger secure hash.

Backward compatibility should be untouched as ``md5`` is being passed
as a default kwarg.  The only change affecting external world is
a new parameter required at ``calculate_digest`` (specifying the
digest to use), but as it has probably no use outside the module,
this is a non-issue.  Alternatively: another optional kwarg.


Update (based Ian's comments):
The algorithm can also be specified as a string referring to the
algorithm known to hashlib (otherwise AttributeError will be raised).


Example session I used to check it works as expected (longish):

&gt;&gt;&gt; import sys; sys.path.append('../..')
&gt;&gt;&gt; from hashlib import sha256, sha512
&gt;&gt;&gt; execfile('auth_tkt.py')
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0').cookie_value()
'39fecb1395af5285232be390eba0eed34f5518c8me!'
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0', "md5").cookie_value()
'c3b8eacbbbf76a9c993c7dcb99975d504f5518cfme!m,d,5!'
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0', digest_algo="md5") \
... .cookie_value()
'db3b04de3c44b5bd0e2b47019e903c064f5518dbme!'
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0', digest_algo="sha1") \
... .cookie_value()
'dddaadc2be960b6e89263ae7fb8c39591554103d4f5518edme!'
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0', digest_algo=sha256) \
... .cookie_value()
'bf5c9a32e49920f2ca517ec19a9d55e10a83849e5d532e8997891b8ccdbf0e634f551902me!'
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0', digest_algo="sha256") \
... .cookie_value()
'9cb12df90fd86b868c98353115df4da3b8f9fa83bebecdf0b7918fea5d06b0744f551908me!'
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0', digest_algo='foo') \
... .cookie_value()
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "auth_tkt.py", line 107, in __init__
    self.digest_algo = getattr(hashlib, digest_algo)
AttributeError: 'module' object has no attribute 'foo'
&gt;&gt;&gt;
&gt;&gt;&gt; parse_ticket('secret', \
...     AuthTicket('secret', 'me', '0.0.0.0').cookie_value(),'0.0.0.0')
(1330977060, 'me', [''], '')
&gt;&gt;&gt; parse_ticket('secret', \
...     AuthTicket('secret', 'me', '0.0.0.0', digest_algo='md5') \
... .cookie_value(),'0.0.0.0', digest_algo='md5')
(1330977096, 'me', [''], '')
&gt;&gt;&gt; parse_ticket('secret', \
...     AuthTicket('secret', 'me', '0.0.0.0', digest_algo=sha256) \
... .cookie_value(),'0.0.0.0', digest_algo=sha256)
(1330977115, 'me', [''], '')
&gt;&gt;&gt; parse_ticket('secret', \
...     AuthTicket('secret', 'me', '0.0.0.0', digest_algo=sha512) \
... .cookie_value(),'0.0.0.0', digest_algo=sha512)
(1330977125, 'me', [''], '')
&gt;&gt;&gt; parse_ticket('secret', \
...     AuthTicket('secret', 'me', '0.0.0.0', digest_algo=sha512) \
... .cookie_value(),'0.0.0.0')
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "auth_tkt.py", line 179, in parse_ticket
    expected=(expected, digest))
__main__.BadTicket: Digest signature is not correct


[1] http://linux.die.net/man/3/mod_auth_tkt
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, mod_auth_tkt supports also SHA256 and SHA 512 [1],
not just plain MD5.  Quoting:

----v----
The default is MD5, which is faster, but has now been shown to be
vulnerable to collision attacks. Such attacks are not directly applicable
to mod_auth_tkt, which primarily relies on the security of the shared
secret rather than the strength of the hashing scheme. More paranoid users
will probably prefer to use one of the SHA digest types, however.

The default is likely to change in a future version, so setting the digest
type explicitly is encouraged.
----^----

Thus, enable it also in this implementation so one can optionally switch
to a stronger secure hash.

Backward compatibility should be untouched as ``md5`` is being passed
as a default kwarg.  The only change affecting external world is
a new parameter required at ``calculate_digest`` (specifying the
digest to use), but as it has probably no use outside the module,
this is a non-issue.  Alternatively: another optional kwarg.


Update (based Ian's comments):
The algorithm can also be specified as a string referring to the
algorithm known to hashlib (otherwise AttributeError will be raised).


Example session I used to check it works as expected (longish):

&gt;&gt;&gt; import sys; sys.path.append('../..')
&gt;&gt;&gt; from hashlib import sha256, sha512
&gt;&gt;&gt; execfile('auth_tkt.py')
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0').cookie_value()
'39fecb1395af5285232be390eba0eed34f5518c8me!'
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0', "md5").cookie_value()
'c3b8eacbbbf76a9c993c7dcb99975d504f5518cfme!m,d,5!'
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0', digest_algo="md5") \
... .cookie_value()
'db3b04de3c44b5bd0e2b47019e903c064f5518dbme!'
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0', digest_algo="sha1") \
... .cookie_value()
'dddaadc2be960b6e89263ae7fb8c39591554103d4f5518edme!'
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0', digest_algo=sha256) \
... .cookie_value()
'bf5c9a32e49920f2ca517ec19a9d55e10a83849e5d532e8997891b8ccdbf0e634f551902me!'
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0', digest_algo="sha256") \
... .cookie_value()
'9cb12df90fd86b868c98353115df4da3b8f9fa83bebecdf0b7918fea5d06b0744f551908me!'
&gt;&gt;&gt; AuthTicket('secret', 'me', '0.0.0.0', digest_algo='foo') \
... .cookie_value()
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "auth_tkt.py", line 107, in __init__
    self.digest_algo = getattr(hashlib, digest_algo)
AttributeError: 'module' object has no attribute 'foo'
&gt;&gt;&gt;
&gt;&gt;&gt; parse_ticket('secret', \
...     AuthTicket('secret', 'me', '0.0.0.0').cookie_value(),'0.0.0.0')
(1330977060, 'me', [''], '')
&gt;&gt;&gt; parse_ticket('secret', \
...     AuthTicket('secret', 'me', '0.0.0.0', digest_algo='md5') \
... .cookie_value(),'0.0.0.0', digest_algo='md5')
(1330977096, 'me', [''], '')
&gt;&gt;&gt; parse_ticket('secret', \
...     AuthTicket('secret', 'me', '0.0.0.0', digest_algo=sha256) \
... .cookie_value(),'0.0.0.0', digest_algo=sha256)
(1330977115, 'me', [''], '')
&gt;&gt;&gt; parse_ticket('secret', \
...     AuthTicket('secret', 'me', '0.0.0.0', digest_algo=sha512) \
... .cookie_value(),'0.0.0.0', digest_algo=sha512)
(1330977125, 'me', [''], '')
&gt;&gt;&gt; parse_ticket('secret', \
...     AuthTicket('secret', 'me', '0.0.0.0', digest_algo=sha512) \
... .cookie_value(),'0.0.0.0')
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "auth_tkt.py", line 179, in parse_ticket
    expected=(expected, digest))
__main__.BadTicket: Digest signature is not correct


[1] http://linux.die.net/man/3/mod_auth_tkt
</pre>
</div>
</content>
</entry>
<entry>
<title>auth/auth_tkt.py: enable overriding digest algorithms</title>
<updated>2012-02-29T23:56:41+00:00</updated>
<author>
<name>Jan Pokorn?</name>
<email>jpokorny@redhat.com</email>
</author>
<published>2012-02-29T23:56:41+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/paste.git/commit/?id=531c568bd89a2e34ca3077314587e421c5867091'/>
<id>531c568bd89a2e34ca3077314587e421c5867091</id>
<content type='text'>
Currently, mod_auth_tkt supports also SHA256 and SHA 512 [1],
not just plain MD5.  Quoting:

----v----
The default is MD5, which is faster, but has now been shown to be vulnerable
to collision attacks. Such attacks are not directly applicable to
mod_auth_tkt, which primarily relies on the security of the shared secret
rather than the strength of the hashing scheme. More paranoid users will
probably prefer to use one of the SHA digest types, however.

The default is likely to change in a future version, so setting the digest
type explicitly is encouraged.
----^----

Thus, enable it also in this implementation so one can optionally switch
to a stronger secure hash.

Backward compatibility should be untouched as ``md`` is being passed
as a default kwarg.  The only change affecting external world is
a new parameter required at ``calculate digest`` (specifying the
digest to use), but as it has probably no use outside the module,
this is a non-issue.  Alternatively: another optional kwarg.

[1] http://linux.die.net/man/3/mod_auth_tkt
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, mod_auth_tkt supports also SHA256 and SHA 512 [1],
not just plain MD5.  Quoting:

----v----
The default is MD5, which is faster, but has now been shown to be vulnerable
to collision attacks. Such attacks are not directly applicable to
mod_auth_tkt, which primarily relies on the security of the shared secret
rather than the strength of the hashing scheme. More paranoid users will
probably prefer to use one of the SHA digest types, however.

The default is likely to change in a future version, so setting the digest
type explicitly is encouraged.
----^----

Thus, enable it also in this implementation so one can optionally switch
to a stronger secure hash.

Backward compatibility should be untouched as ``md`` is being passed
as a default kwarg.  The only change affecting external world is
a new parameter required at ``calculate digest`` (specifying the
digest to use), but as it has probably no use outside the module,
this is a non-issue.  Alternatively: another optional kwarg.

[1] http://linux.die.net/man/3/mod_auth_tkt
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix #443: url_unquote undefined</title>
<updated>2010-09-16T17:18:45+00:00</updated>
<author>
<name>Ian Bicking</name>
<email>ianb@colorstudy.com</email>
</author>
<published>2010-09-16T17:18:45+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/paste.git/commit/?id=dc8a588b82fd813876fbfd1fb68d989b9f16bc5f'/>
<id>dc8a588b82fd813876fbfd1fb68d989b9f16bc5f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Quote usernames in auth_tkt tickets (http://trac.pythonpaste.org/pythonpaste/ticket/380)</title>
<updated>2010-09-01T23:42:51+00:00</updated>
<author>
<name>Ian Bicking</name>
<email>ianb@colorstudy.com</email>
</author>
<published>2010-09-01T23:42:51+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/paste.git/commit/?id=0d687c2dacd7485694e093c7f1b7a4777af39aed'/>
<id>0d687c2dacd7485694e093c7f1b7a4777af39aed</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix the auth_tkt middleware so it doesn't give exceptions when the token is bad</title>
<updated>2009-03-07T03:29:21+00:00</updated>
<author>
<name>ianb</name>
<email>devnull@localhost</email>
</author>
<published>2009-03-07T03:29:21+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/paste.git/commit/?id=608be9fa2ca93d0122bb7d3ab39ed6e078ee0b4d'/>
<id>608be9fa2ca93d0122bb7d3ab39ed6e078ee0b4d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Make cookies expire on logout</title>
<updated>2009-03-05T19:00:57+00:00</updated>
<author>
<name>ianb</name>
<email>devnull@localhost</email>
</author>
<published>2009-03-05T19:00:57+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/paste.git/commit/?id=c1cde173851d9713fb0a27f7b6683364ec861940'/>
<id>c1cde173851d9713fb0a27f7b6683364ec861940</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Apply patch to paste.auth.auth_tkt to make it easier to get the cookies, and avoid wildcard cookies, and add httponly support</title>
<updated>2009-03-03T23:52:31+00:00</updated>
<author>
<name>ianb</name>
<email>devnull@localhost</email>
</author>
<published>2009-03-03T23:52:31+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/paste.git/commit/?id=6c6088e2216956d0c77ac890894bd0922b998c7e'/>
<id>6c6088e2216956d0c77ac890894bd0922b998c7e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>prefer hashlib over the md5/sha modules which are deprecated in Python 2.6</title>
<updated>2008-09-17T22:18:35+00:00</updated>
<author>
<name>pjenvey</name>
<email>devnull@localhost</email>
</author>
<published>2008-09-17T22:18:35+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/paste.git/commit/?id=53e7d3ce846eaf9546b0a413c2921627138ecc45'/>
<id>53e7d3ce846eaf9546b0a413c2921627138ecc45</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Set same cookies with same domains on logout as you do on login, in auth_tkt</title>
<updated>2008-03-08T21:50:15+00:00</updated>
<author>
<name>ianb</name>
<email>devnull@localhost</email>
</author>
<published>2008-03-08T21:50:15+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/paste.git/commit/?id=76be018175929b69da33992804c86c4f5495abf1'/>
<id>76be018175929b69da33992804c86c4f5495abf1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Try to encode values to auth_tkt</title>
<updated>2007-08-09T15:52:56+00:00</updated>
<author>
<name>ianb</name>
<email>devnull@localhost</email>
</author>
<published>2007-08-09T15:52:56+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/paste.git/commit/?id=d82bca0314d175a859f303ee7e43ce985cf8561b'/>
<id>d82bca0314d175a859f303ee7e43ce985cf8561b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
