Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov committed May 2, 2023
1 parent 965c701 commit c9b60c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
See login/decorators.py
Based on https://aiohttp-security.readthedocs.io/en/latest/
"""
# pylint: disable=assignment-from-no-return
import logging

import aiohttp_security
Expand All @@ -29,9 +28,11 @@ def setup_security(app: web.Application):
identity_policy = SessionIdentityPolicy()

# TODO: limitations is that it cannot contain checks need to be added here
access_model = RoleBasedAccessModel.from_rawdata(ROLES_PERMISSIONS)
role_based_access_model = RoleBasedAccessModel.from_rawdata(ROLES_PERMISSIONS)

# TODO: create basic/bearer authentication policy based on tokens instead of cookies!!
# when you do that, also update the openapi to reflect that
authorization_policy = AuthorizationPolicy(app, access_model)
authorization_policy = AuthorizationPolicy(
app, access_model=role_based_access_model
)
aiohttp_security.setup(app, identity_policy, authorization_policy)

0 comments on commit c9b60c0

Please sign in to comment.