Skip to content

Commit f2c1cff

Browse files
committed
Add support of new IAM driver
Signed-off-by: Anton Kremenetsky <anton.kremenetsky@gmail.com>
1 parent 5da353d commit f2c1cff

File tree

5 files changed

+564
-21
lines changed

5 files changed

+564
-21
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: build
22

33
on:
44
push:
5+
workflow_dispatch:
56

67
env:
78
PROJECT_NAME: genesis-notification

genesis_notification/cmd/user_api.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
from gcl_looper.services import bjoern_service
2121
from gcl_looper.services import hub
22+
from gcl_iam import drivers
2223
from gcl_iam import opts as iam_opts
2324
from oslo_config import cfg
2425
from restalchemy.common import config_opts as ra_config_opts
@@ -64,21 +65,22 @@ def main():
6465
infra_log.configure()
6566
log = logging.getLogger(__name__)
6667

67-
token_algorithm = iam_opts.get_token_encryption_algorithm(CONF)
68-
6968
log.info(
7069
"Start service on %s:%s",
7170
CONF[DOMAIN].bind_host,
7271
CONF[DOMAIN].bind_port,
7372
)
7473

7574
service_hub = hub.ProcessHubService()
75+
iam_driver = drivers.HttpDriver(
76+
CONF.iam.iam_endpoint,
77+
CONF.iam.audience,
78+
CONF.iam.hs256_jwks_decryption_key,
79+
)
7680

7781
for _ in range(CONF[DOMAIN].workers):
7882
service = bjoern_service.BjoernService(
79-
wsgi_app=app.build_wsgi_application(
80-
token_algorithm=token_algorithm,
81-
),
83+
wsgi_app=app.build_wsgi_application(iam_driver),
8284
host=CONF[DOMAIN].bind_host,
8385
port=CONF[DOMAIN].bind_port,
8486
bjoern_kwargs=dict(reuse_port=True),

genesis_notification/user_api/api/app.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def get_openapi_engine():
6363
return openapi_engine
6464

6565

66-
def build_wsgi_application(token_algorithm, iam_engine_driver=None):
66+
def build_wsgi_application(iam_engine_driver):
6767
return middlewares.attach_middlewares(
6868
applications.OpenApiApplication(
6969
route_class=get_api_application(),
@@ -72,7 +72,6 @@ def build_wsgi_application(token_algorithm, iam_engine_driver=None):
7272
[
7373
middlewares.configure_middleware(
7474
iam_mw.GenesisCoreAuthMiddleware,
75-
token_algorithm=token_algorithm,
7675
iam_engine_driver=iam_engine_driver,
7776
skip_auth_endpoints=skip_auth_endpoints,
7877
),

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ classifiers = [
2121
]
2222
dependencies = [
2323
"oslo.config>=3.22.2,<10.0.0", # Apache-2.0
24-
"restalchemy>=14.1.0,<15.0.0", # Apache-2.0
25-
"gcl_iam>=0.8.0,<1.0.0", # Apache-2.0
26-
"gcl_looper>=0.1.0,<=1.0.0", # Apache-2.0
24+
"restalchemy>=15.0.0,<16.0.0", # Apache-2.0
25+
"gcl_iam>=1.0.0,<2.0.0", # Apache-2.0
26+
"gcl_looper>=1.0.0,<2.0.0", # Apache-2.0
2727
"bjoern>=3.2.2", # Apache-2.0
2828
"Jinja2>=3.1.5,<4.0.0", # Apache-2.0
2929
"bazooka>=1.3.0,<2.0.0", # Apache-2.0

0 commit comments

Comments
 (0)