|
4 | 4 | import flask_restful
|
5 | 5 | from flask import Flask, Response, send_from_directory
|
6 | 6 | from flask_security import Security
|
| 7 | +from pymongo import MongoClient |
7 | 8 | from werkzeug.exceptions import NotFound
|
8 | 9 |
|
9 | 10 | from common import DIContainer
|
|
44 | 45 | from monkey_island.cc.services.authentication_service.configure_flask_security import (
|
45 | 46 | configure_flask_security,
|
46 | 47 | )
|
| 48 | +from monkey_island.cc.services.authentication_service.mongo_otp_repository import MongoOTPRepository |
47 | 49 | from monkey_island.cc.services.authentication_service.token_generator import TokenGenerator
|
48 | 50 | from monkey_island.cc.services.authentication_service.token_parser import TokenParser
|
49 | 51 | from monkey_island.cc.services.representations import output_json
|
@@ -163,18 +165,21 @@ def init_app(
|
163 | 165 | def _build_authentication_facade(container: DIContainer, security: Security):
|
164 | 166 | repository_encryptor = container.resolve(ILockableEncryptor)
|
165 | 167 | island_event_queue = container.resolve(IIslandEventQueue)
|
| 168 | + mongo_client = container.resolve(MongoClient) |
166 | 169 |
|
167 | 170 | token_generator = TokenGenerator(security)
|
168 | 171 | refresh_token_expiration = (
|
169 | 172 | security.app.config["SECURITY_TOKEN_MAX_AGE"]
|
170 | 173 | + security.app.config["SECURITY_REFRESH_TOKEN_TIMEDELTA"]
|
171 | 174 | )
|
172 | 175 | token_parser = TokenParser(security, refresh_token_expiration)
|
| 176 | + otp_repository = MongoOTPRepository(mongo_client, repository_encryptor) |
173 | 177 |
|
174 | 178 | return AuthenticationFacade(
|
175 | 179 | repository_encryptor,
|
176 | 180 | island_event_queue,
|
177 | 181 | security.datastore,
|
178 | 182 | token_generator,
|
179 | 183 | token_parser,
|
| 184 | + otp_repository, |
180 | 185 | )
|
0 commit comments