mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 23:37:18 +00:00
update dependencies list
This commit is contained in:
parent
89aa8f0b45
commit
40ef103e2f
@ -15,7 +15,10 @@ optdepends=('breezy: -bzr packages support'
|
|||||||
'mercurial: -hg packages support'
|
'mercurial: -hg packages support'
|
||||||
'python-aiohttp: web server'
|
'python-aiohttp: web server'
|
||||||
'python-aiohttp-jinja2: web server'
|
'python-aiohttp-jinja2: web server'
|
||||||
|
'python-aiohttp-security: web server with authorization'
|
||||||
|
'python-aiohttp-session: web server with authorization'
|
||||||
'python-boto3: sync to s3'
|
'python-boto3: sync to s3'
|
||||||
|
'python-cryptography: web server with authorization'
|
||||||
'python-jinja: html report generation'
|
'python-jinja: html report generation'
|
||||||
'rsync: sync by using rsync'
|
'rsync: sync by using rsync'
|
||||||
'subversion: -svn packages support')
|
'subversion: -svn packages support')
|
||||||
|
@ -18,10 +18,14 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
import aiohttp_security # type: ignore
|
import aiohttp_security # type: ignore
|
||||||
|
import base64
|
||||||
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
from aiohttp.web import middleware, Request
|
from aiohttp.web import middleware, Request
|
||||||
from aiohttp.web_response import StreamResponse
|
from aiohttp.web_response import StreamResponse
|
||||||
|
from aiohttp_session import setup as setup_session # type: ignore
|
||||||
|
from aiohttp_session.cookie_storage import EncryptedCookieStorage # type: ignore
|
||||||
|
from cryptography import fernet
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from ahriman.core.auth import Auth
|
from ahriman.core.auth import Auth
|
||||||
@ -92,6 +96,11 @@ def setup_auth(application: web.Application, configuration: Configuration) -> we
|
|||||||
:param configuration: configuration instance
|
:param configuration: configuration instance
|
||||||
:return: configured web application
|
:return: configured web application
|
||||||
"""
|
"""
|
||||||
|
fernet_key = fernet.Fernet.generate_key()
|
||||||
|
secret_key = base64.urlsafe_b64decode(fernet_key)
|
||||||
|
storage = EncryptedCookieStorage(secret_key, cookie_name='API_SESSION')
|
||||||
|
setup_session(application, storage)
|
||||||
|
|
||||||
authorization_policy = AuthorizationPolicy(configuration)
|
authorization_policy = AuthorizationPolicy(configuration)
|
||||||
identity_policy = aiohttp_security.SessionIdentityPolicy()
|
identity_policy = aiohttp_security.SessionIdentityPolicy()
|
||||||
|
|
||||||
|
@ -18,19 +18,14 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
import aiohttp_jinja2
|
import aiohttp_jinja2
|
||||||
import base64
|
|
||||||
import jinja2
|
import jinja2
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
from aiohttp_session import setup as setup_session # type: ignore
|
|
||||||
from aiohttp_session.cookie_storage import EncryptedCookieStorage # type: ignore
|
|
||||||
from cryptography import fernet
|
|
||||||
|
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.exceptions import InitializeException
|
from ahriman.core.exceptions import InitializeException
|
||||||
from ahriman.core.status.watcher import Watcher
|
from ahriman.core.status.watcher import Watcher
|
||||||
from ahriman.web.middlewares.auth_handler import setup_auth
|
|
||||||
from ahriman.web.middlewares.exception_handler import exception_handler
|
from ahriman.web.middlewares.exception_handler import exception_handler
|
||||||
from ahriman.web.routes import setup_routes
|
from ahriman.web.routes import setup_routes
|
||||||
|
|
||||||
@ -97,12 +92,8 @@ def setup_service(architecture: str, configuration: Configuration) -> web.Applic
|
|||||||
application.logger.info("setup watcher")
|
application.logger.info("setup watcher")
|
||||||
application["watcher"] = Watcher(architecture, configuration)
|
application["watcher"] = Watcher(architecture, configuration)
|
||||||
|
|
||||||
fernet_key = fernet.Fernet.generate_key()
|
|
||||||
secret_key = base64.urlsafe_b64decode(fernet_key)
|
|
||||||
storage = EncryptedCookieStorage(secret_key, cookie_name='API_SESSION')
|
|
||||||
setup_session(application, storage)
|
|
||||||
|
|
||||||
if configuration.getboolean("web", "auth", fallback=False):
|
if configuration.getboolean("web", "auth", fallback=False):
|
||||||
|
from ahriman.web.middlewares.auth_handler import setup_auth
|
||||||
setup_auth(application, configuration)
|
setup_auth(application, configuration)
|
||||||
|
|
||||||
return application
|
return application
|
||||||
|
Loading…
Reference in New Issue
Block a user