6 Commits

Author SHA1 Message Date
dependabot-preview[bot]
e9f5a4d31c Bump sphinx from 3.4.1 to 3.4.3
Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 3.4.1 to 3.4.3.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/3.x/CHANGES)
- [Commits](https://github.com/sphinx-doc/sphinx/compare/v3.4.1...v3.4.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-08 05:56:18 +00:00
dependabot-preview[bot]
3298ff4e7c Bump sphinx from 3.4.0 to 3.4.1 (#377)
Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 3.4.0 to 3.4.1.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/3.x/CHANGES)
- [Commits](https://github.com/sphinx-doc/sphinx/compare/v3.4.0...v3.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-25 18:36:45 +02:00
dependabot-preview[bot]
37b21b5f17 Bump pytest-mock from 3.3.1 to 3.4.0 (#370)
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.3.1...v3.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-21 15:58:19 +02:00
dependabot-preview[bot]
4b2d99f2a8 Bump pytest from 6.1.2 to 6.2.1 (#369)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.1.2 to 6.2.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.1.2...6.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-21 15:52:08 +02:00
dependabot-preview[bot]
25d1bc62b8 Bump sphinx from 3.3.1 to 3.4.0 (#374)
Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/3.x/CHANGES)
- [Commits](https://github.com/sphinx-doc/sphinx/compare/v3.3.1...v3.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-21 15:37:44 +02:00
dependabot-preview[bot]
27692c0aad Bump coverage from 5.3 to 5.3.1 (#375)
Bumps [coverage](https://github.com/nedbat/coveragepy) from 5.3 to 5.3.1.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](https://github.com/nedbat/coveragepy/compare/coverage-5.3...coverage-5.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-21 15:04:40 +02:00
3 changed files with 7 additions and 8 deletions

View File

@@ -15,12 +15,11 @@ AUTH_SCHEME = 'Bearer '
class JWTIdentityPolicy(AbstractIdentityPolicy):
def __init__(self, secret, algorithm='HS256', key: str = 'login'):
def __init__(self, secret, algorithm='HS256'):
if jwt is None:
raise RuntimeError('Please install `PyJWT`')
self.secret = secret
self.algorithm = algorithm
self.key = key
async def identify(self, request):
header_identity = request.headers.get(AUTH_HEADER_NAME)
@@ -37,7 +36,7 @@ class JWTIdentityPolicy(AbstractIdentityPolicy):
identity = jwt.decode(token,
self.secret,
algorithms=[self.algorithm])
return identity.get(self.key)
return identity
async def remember(self, *args, **kwargs): # pragma: no cover
pass

View File

@@ -1,11 +1,11 @@
-e .
flake8==3.8.4
async-timeout==3.0.1
pytest==6.1.2
pytest==6.2.1
pytest-cov==2.10.1
pytest-mock==3.3.1
coverage==5.3
sphinx==3.3.1
pytest-mock==3.4.0
coverage==5.3.1
sphinx==3.4.3
pep257==0.7.0
aiohttp-session==2.9.0
aiopg[sa]==1.1.0

View File

@@ -43,7 +43,7 @@ async def test_identify(loop, make_token, aiohttp_client):
async def check(request):
policy = request.app[IDENTITY_KEY]
identity = await policy.identify(request)
assert 'Andrew' == identity
assert 'Andrew' == identity['login']
return web.Response()
app = web.Application()