Skip to content

Commit 3276904

Browse files
author
Sergio García Prado
authored
Merge pull request #88 from minos-framework/0.3.0
0.3.0
2 parents 5e393ad + 49ff84f commit 3276904

File tree

7 files changed

+26
-5
lines changed

7 files changed

+26
-5
lines changed

HISTORY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,8 @@
3939
* Add PostgreSQL database with SQLAlchemy dependency.
4040
* Auth Rules for authentication.
4141
* Administration section for rules management.
42+
43+
## 0.3.0 (2022-02-04)
44+
45+
* Administration section BugFix getting index file.
46+
* Adjust default auth routes

minos/api_gateway/rest/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.2.0"
1+
__version__ = "0.3.0"
22

33
from .config import (
44
ApiGatewayConfig,

minos/api_gateway/rest/handler.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ async def authentication_default(request: web.Request) -> web.Response:
7272
return await authentication_call(request, url)
7373

7474

75+
async def login_default(request: web.Request) -> web.Response:
76+
""" Orchestrate discovery and microservice call """
77+
auth_host = request.app["config"].rest.auth.host
78+
auth_port = request.app["config"].rest.auth.port
79+
auth_path = request.app["config"].rest.auth.path
80+
default_service = request.app["config"].rest.auth.default
81+
82+
url = URL(f"http://{auth_host}:{auth_port}{auth_path}/{default_service}/login")
83+
84+
return await authentication_call(request, url)
85+
86+
7587
async def authentication(request: web.Request) -> web.Response:
7688
""" Orchestrate discovery and microservice call """
7789

minos/api_gateway/rest/service.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
AdminHandler,
2929
authentication,
3030
authentication_default,
31+
login_default,
3132
orchestrate,
3233
)
3334

@@ -57,8 +58,10 @@ async def create_application(self) -> web.Application:
5758
auth = self.config.rest.auth
5859
if auth is not None and auth.enabled:
5960
app.router.add_route("*", "/auth", authentication_default)
61+
app.router.add_route("*", "/auth/login", login_default)
6062
for service in auth.services:
6163
app.router.add_route("*", f"/auth/{service.name}", authentication)
64+
app.router.add_route("POST", f"/auth/{service.name}/login", authentication)
6265

6366
app.router.add_route("POST", "/admin/login", AdminHandler.login)
6467
app.router.add_route("GET", "/admin/endpoints", AdminHandler.get_endpoints)
@@ -68,7 +71,8 @@ async def create_application(self) -> web.Application:
6871
app.router.add_route("DELETE", "/admin/rules/{id}", AdminHandler.delete_rule)
6972

7073
# Administration routes
71-
aiohttp_jinja2.setup(app, loader=jinja2.FileSystemLoader("minos/api_gateway/rest/backend/templates"))
74+
path = Path(Path.cwd())
75+
aiohttp_jinja2.setup(app, loader=jinja2.FileSystemLoader(f"{path}/minos/api_gateway/rest/backend/templates"))
7276
app.router.add_route("*", "/administration{path:.*}", self.handler)
7377
# app.router.add_route("GET", "/administration/{filename:.*}", self._serve_files)
7478

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "minos_apigateway"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
description = "Python Package containing the main API Gateway implementation used in Minos Microservices."
55
readme = "README.md"
66
repository = "https://github.com/clariteia/api_gateway"

tests/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ rest:
1414
services:
1515
- name: token
1616
- name: credentials
17-
default: token
17+
default: credentials
1818
database:
1919
dbname: api_gateway_db
2020
user: minos

tests/test_api_gateway/test_rest/test_authentication.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ async def test_auth_headers_3(self):
120120

121121
@unittest_run_loop
122122
async def test_default_auth_headers(self):
123-
url = "/auth"
123+
url = "/auth/token"
124124
headers = {"Authorization": "Bearer credential-token-test"}
125125

126126
response = await self.client.request("POST", url, headers=headers)

0 commit comments

Comments
 (0)