Skip to content

Commit b2b0a84

Browse files
ISSUE #85
1 parent eb6d2f7 commit b2b0a84

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

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: 3 additions & 0 deletions
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)

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

0 commit comments

Comments
 (0)