Gentoo Archives: gentoo-commits

From: Mike Auty <ikelos@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/ikelos:master commit in: dev-python/repoze-who-plugins-digestauth/files/, ...
Date: Fri, 29 Jan 2016 15:54:45
Message-Id: 1454082874.9c5f2400ad50ed24ec9407f2f272512089688ddc.ikelos@gentoo
1 commit: 9c5f2400ad50ed24ec9407f2f272512089688ddc
2 Author: layman <layman <AT> localhost>
3 AuthorDate: Fri Jan 29 15:54:34 2016 +0000
4 Commit: Mike Auty <ikelos <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 29 15:54:34 2016 +0000
6 URL: https://gitweb.gentoo.org/dev/ikelos.git/commit/?id=9c5f2400
7
8 Add in repoze-who-plugins-digestauth.
9
10 dev-python/repoze-who-plugins-digestauth/ChangeLog | 21 ++++
11 dev-python/repoze-who-plugins-digestauth/Manifest | 5 +
12 .../repoze-who-plugins-digestauth-python3.patch | 121 +++++++++++++++++++++
13 .../repoze-who-plugins-digestauth/metadata.xml | 15 +++
14 .../repoze-who-plugins-digestauth-0.1.1.ebuild | 32 ++++++
15 5 files changed, 194 insertions(+)
16
17 diff --git a/dev-python/repoze-who-plugins-digestauth/ChangeLog b/dev-python/repoze-who-plugins-digestauth/ChangeLog
18 new file mode 100644
19 index 0000000..28b6331
20 --- /dev/null
21 +++ b/dev-python/repoze-who-plugins-digestauth/ChangeLog
22 @@ -0,0 +1,21 @@
23 +# ChangeLog for dev-python/repoze-who
24 +# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
25 +# $Header: /var/cvsroot/gentoo-x86/dev-python/repoze-who/ChangeLog,v 1.5 2015/07/08 20:55:35 zlogene Exp $
26 +
27 + 08 Jul 2015; Mikle Kolyada <zlogene@g.o> repoze-who-2.2.ebuild:
28 + x86 stable wrt bug #554114
29 +
30 + 07 Jul 2015; Mikle Kolyada <zlogene@g.o> repoze-who-2.2.ebuild:
31 + amd64 stable wrt bug #554114
32 +
33 + 03 Jun 2015; Justin Lecher <jlec@g.o> metadata.xml:
34 + Add pypi to remote-id in metadata.xml
35 +
36 + 12 Dec 2014; Michał Górny <mgorny@g.o> repoze-who-2.2.ebuild:
37 + Rename net-zope/zope-interface to dev-python/zope-interface.
38 +
39 +*repoze-who-2.2 (10 Nov 2014)
40 +
41 + 10 Nov 2014; Matthew Thode <prometheanfire@g.o> +metadata.xml,
42 + +repoze-who-2.2.ebuild:
43 + needed as a dep of a dep of openstack
44
45 diff --git a/dev-python/repoze-who-plugins-digestauth/Manifest b/dev-python/repoze-who-plugins-digestauth/Manifest
46 new file mode 100644
47 index 0000000..f589961
48 --- /dev/null
49 +++ b/dev-python/repoze-who-plugins-digestauth/Manifest
50 @@ -0,0 +1,5 @@
51 +AUX repoze-who-plugins-digestauth-python3.patch 5488 SHA256 404489f5941a405f42adeb2a4e0db9620de069b8836545bb6353a8edd88eb728 SHA512 5b2a736285e00c8a53f83f9771754295b7ff0525284236b600af26bb4fe974c253ffb1d6d456501fc9c7f9594ff4854fe28eeaefad6e646fc853f31eb9b1270e WHIRLPOOL 395097ee6e9da53a72960ef11557fa0c0109d94b60f9d941da76f172e285bba9f4439054c281ece36e1d37126096770e42838c5322871b5356cf924b44f5184b
52 +DIST repoze.who.plugins.digestauth-0.1.1.tar.gz 16479 SHA256 4594155a1d4171d3935176c49b8b87048a03199e1cde83c2bff4e72e96b20a81 SHA512 48da3d18a6415a78c84f715f2fda45627d0b2104e0b52a6849dc1893499501941987f602d6e52bda73985293416d41f19887a0f79d5b1a64673a95dc2ca95813 WHIRLPOOL c0d7fe76830837bcf52d802295c2e0bbcf1aac9a0375d0818516628c860b435fbf676c169a57a16a11d22950711a366ea4124bffa8d775d3d9470d00aa7e71b6
53 +EBUILD repoze-who-plugins-digestauth-0.1.1.ebuild 791 SHA256 56eb1b34769158689e81deeee44fa8f3a1d0de5f10b26fe61f8971ee8fe8c83a SHA512 245cff489d5f862fb7b70a35d5377446c9efde5d78ad89f0bb0353653e6d88c32cccfa3e2be9585568ea213acc087b53f88c399461439e380294671c99dd8696 WHIRLPOOL 195db1dbdcd2e725afe7bad936900043037f95e6ceb7e57fcc3455a3e84878ed343159c941537edb0186e89930cfddc9abd3a017920690f5e6f3bf16162e194d
54 +MISC ChangeLog 832 SHA256 7a84b13a43ee28ce47e97dd9322619628ff693ad53c562dc01e8dcffa28892b1 SHA512 8cd128a1d9142a408360752e771d1a867c95393bd2ea84a587cf14083d00f57986378759a335b6fc19f000af871dccf4b8144dfe34a2cd796acb938b8698533d WHIRLPOOL 03668ca714b757c9117e2f084fe2efede5cfc51e54eecf5bf74ab0b14ecdd8d73535dd4e997dfea8c48d8c36e24e94cb3d80856673411114e54eae1b524b954d
55 +MISC metadata.xml 456 SHA256 62fff4ca239fc82c6c2a315f24176254efd7ca1e932abc79a69f7473501dfc4d SHA512 943257b6a18e32931d2a832275941838c2a3de0760ad54831180d74117e138cb5e3a916675784670ad455f4d60025c02488c60110db1780238cc17e6aee5a916 WHIRLPOOL 1271e9aebc30fb93d0a673c92b17c6975ff13c90d403487f478c365701510b44be18bcfc66f896c35ad328c9f6f7227ccc70b89e850e2142b1866f786631e14b
56
57 diff --git a/dev-python/repoze-who-plugins-digestauth/files/repoze-who-plugins-digestauth-python3.patch b/dev-python/repoze-who-plugins-digestauth/files/repoze-who-plugins-digestauth-python3.patch
58 new file mode 100644
59 index 0000000..225bafd
60 --- /dev/null
61 +++ b/dev-python/repoze-who-plugins-digestauth/files/repoze-who-plugins-digestauth-python3.patch
62 @@ -0,0 +1,121 @@
63 +diff --git a/repoze/who/plugins/digestauth/__init__.py b/repoze/who/plugins/digestauth/__init__.py
64 +index 849361c..6e3414e 100644
65 +--- a/repoze/who/plugins/digestauth/__init__.py
66 ++++ b/repoze/who/plugins/digestauth/__init__.py
67 +@@ -18,7 +18,7 @@ __ver_tuple__ = (__ver_major__, __ver_minor__, __ver_patch__, __ver_sub__)
68 + __version__ = "%d.%d.%d%s" % __ver_tuple__
69 +
70 +
71 +-from zope.interface import implements
72 ++from zope.interface import implementer
73 +
74 + from repoze.who.interfaces import IIdentifier, IChallenger, IAuthenticator
75 + from repoze.who.utils import resolveDotted
76 +@@ -33,6 +33,7 @@ from repoze.who.plugins.digestauth.utils import (extract_digest_credentials,
77 + _ENVKEY_STALE_NONCE = "repoze.who.plugins.digestauth.stale_nonce"
78 +
79 +
80 ++@implementer(IIdentifier, IChallenger, IAuthenticator)
81 + class DigestAuthPlugin(object):
82 + """A repoze.who plugin for authentication via HTTP-Digest-Auth.
83 +
84 +@@ -76,8 +77,6 @@ class DigestAuthPlugin(object):
85 + suitable for most purposes.
86 + """
87 +
88 +- implements(IIdentifier, IChallenger, IAuthenticator)
89 +-
90 + def __init__(self, realm, nonce_manager=None, domain=None, qop=None,
91 + get_password=None, get_pwdhash=None):
92 + if nonce_manager is None:
93 +@@ -244,7 +243,7 @@ class DigestAuthPlugin(object):
94 + # Escape any special characters in those values, so we can send
95 + # them as quoted-strings. The extra values added below are under
96 + # our control so we know they don't contain quotes.
97 +- for key, value in params.iteritems():
98 ++ for key, value in iter(params.items()):
99 + params[key] = value.replace('"', '\\"')
100 + # Mark the nonce as stale if told so by the environment.
101 + # NOTE: The RFC says the server "should only set stale to TRUE if
102 +@@ -255,7 +254,7 @@ class DigestAuthPlugin(object):
103 + params["stale"] = "TRUE"
104 + params["algorithm"] = "MD5"
105 + # Construct the final header as quoted-string k/v pairs.
106 +- value = ", ".join('%s="%s"' % itm for itm in params.iteritems())
107 ++ value = ", ".join('%s="%s"' % itm for itm in iter(params.items()))
108 + value = "Digest " + value
109 + return [("WWW-Authenticate", value)]
110 +
111 +diff --git a/repoze/who/plugins/digestauth/noncemanager.py b/repoze/who/plugins/digestauth/noncemanager.py
112 +index b819532..9bb44f8 100644
113 +--- a/repoze/who/plugins/digestauth/noncemanager.py
114 ++++ b/repoze/who/plugins/digestauth/noncemanager.py
115 +@@ -13,6 +13,7 @@ import hmac
116 + import base64
117 + import heapq
118 + import threading
119 ++import binascii
120 + from hashlib import md5
121 +
122 + from repoze.who.plugins.digestauth.utils import strings_differ
123 +@@ -150,7 +151,7 @@ class SignedNonceManager(object):
124 + timestamp = timestamp[:-1]
125 + # Add some random bytes to avoid repeating nonces when several are
126 + # generated very close together.
127 +- data = "%s:%s" % (timestamp, os.urandom(3).encode("hex"))
128 ++ data = "%s:%s" % (timestamp, binascii.hexlify(os.urandom(3)))
129 + # Append the signature.
130 + sig = self._get_signature(data, environ)
131 + return "%s:%s" % (data, sig)
132 +@@ -243,8 +244,8 @@ class SignedNonceManager(object):
133 + """
134 + # We're using md5 for the digest; using something stronger
135 + # for the HMAC probably won't win us much.
136 +- sig = hmac.new(self.secret, value, md5)
137 ++ sig = hmac.new(self.secret, value.encode("ascii"), md5)
138 + for header in self.sign_headers:
139 +- sig.update("\x00")
140 +- sig.update(environ.get(header, ""))
141 ++ sig.update(b"\x00")
142 ++ sig.update(environ.get(header, "").encode("ascii"))
143 + return base64.b64encode(sig.digest())
144 +diff --git a/repoze/who/plugins/digestauth/tests.py b/repoze/who/plugins/digestauth/tests.py
145 +index bb5714f..c02340d 100644
146 +--- a/repoze/who/plugins/digestauth/tests.py
147 ++++ b/repoze/who/plugins/digestauth/tests.py
148 +@@ -82,7 +82,7 @@ def build_response(environ, params, username, password, **kwds):
149 + params.setdefault("nc", "0000001")
150 + resp = calculate_digest_response(params, password=password)
151 + params["response"] = resp
152 +- authz = ",".join('%s="%s"' % v for v in params.iteritems())
153 ++ authz = ",".join('%s="%s"' % v for v in iter(params.items()))
154 + environ["HTTP_AUTHORIZATION"] = "Digest " + authz
155 + return params
156 +
157 +@@ -218,7 +218,7 @@ class TestDigestAuthPlugin(unittest.TestCase):
158 + self.assertEquals(resp, "6629fae49393a05397450978507c4ef1")
159 + # Check that we can auth using it.
160 + params["response"] = resp
161 +- authz = ",".join('%s="%s"' % v for v in params.iteritems())
162 ++ authz = ",".join('%s="%s"' % v for v in iter(params.items()))
163 + environ = make_environ(REQUEST_METHOD="GET",
164 + PATH_INFO="/dir/index.html",
165 + HTTP_AUTHORIZATION="Digest " + authz)
166 +diff --git a/repoze/who/plugins/digestauth/utils.py b/repoze/who/plugins/digestauth/utils.py
167 +index 767b54b..dee6290 100644
168 +--- a/repoze/who/plugins/digestauth/utils.py
169 ++++ b/repoze/who/plugins/digestauth/utils.py
170 +@@ -10,9 +10,12 @@ Helper functions for repoze.who.plugins.digestauth.
171 + import re
172 + import base64
173 + import wsgiref.util
174 +-from urlparse import urlparse
175 + from hashlib import md5
176 +
177 ++try:
178 ++ from urlparse import urlparse
179 ++except ImportError:
180 ++ from urllib.parse import urlparse
181 +
182 + # Regular expression matching a single param in the HTTP_AUTHORIZATION header.
183 + # This is basically <name>=<value> where <value> can be an unquoted token,
184
185 diff --git a/dev-python/repoze-who-plugins-digestauth/metadata.xml b/dev-python/repoze-who-plugins-digestauth/metadata.xml
186 new file mode 100644
187 index 0000000..a61ca15
188 --- /dev/null
189 +++ b/dev-python/repoze-who-plugins-digestauth/metadata.xml
190 @@ -0,0 +1,15 @@
191 +<?xml version="1.0" encoding="UTF-8"?>
192 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
193 +<pkgmetadata>
194 + <herd>openstack</herd>
195 + <maintainer>
196 + <email>prometheanfire@g.o</email>
197 + <name>Matthew Thode</name>
198 + </maintainer>
199 + <longdescription lang="en">
200 + an identification and authentication framework for WSGI.
201 + </longdescription>
202 + <upstream>
203 + <remote-id type="pypi">repoze.who</remote-id>
204 + </upstream>
205 +</pkgmetadata>
206
207 diff --git a/dev-python/repoze-who-plugins-digestauth/repoze-who-plugins-digestauth-0.1.1.ebuild b/dev-python/repoze-who-plugins-digestauth/repoze-who-plugins-digestauth-0.1.1.ebuild
208 new file mode 100644
209 index 0000000..d949659
210 --- /dev/null
211 +++ b/dev-python/repoze-who-plugins-digestauth/repoze-who-plugins-digestauth-0.1.1.ebuild
212 @@ -0,0 +1,32 @@
213 +# Copyright 1999-2015 Gentoo Foundation
214 +# Distributed under the terms of the GNU General Public License v2
215 +# $Header: /var/cvsroot/gentoo-x86/dev-python/repoze-who/repoze-who-2.2.ebuild,v 1.4 2015/07/08 20:55:35 zlogene Exp $
216 +
217 +EAPI=5
218 +PYTHON_COMPAT=( python{2_7,3_3,3_4} )
219 +
220 +inherit distutils-r1
221 +
222 +MY_PN="${PN//-/.}"
223 +
224 +DESCRIPTION="repoze.who is an identification and authentication framework for WSGI."
225 +HOMEPAGE="http://www.repoze.org"
226 +SRC_URI="mirror://pypi/${PN:0:1}/${MY_PN}/${MY_PN}-${PV}.tar.gz"
227 +S="${WORKDIR}/${MY_PN}-${PV}"
228 +
229 +LICENSE="repoze"
230 +SLOT="0"
231 +KEYWORDS="amd64 x86"
232 +IUSE=""
233 +
234 +DEPEND="
235 + dev-python/setuptools[${PYTHON_USEDEP}]
236 +"
237 +RDEPEND="
238 + dev-python/webob[${PYTHON_USEDEP}]
239 + dev-python/zope-interface[${PYTHON_USEDEP}]
240 +"
241 +
242 +src_prepare() {
243 + epatch "${FILESDIR}/${PN}-python3.patch"
244 +}