From 03647dc362ea7a124963dda495671c3a15a17619 Mon Sep 17 00:00:00 2001 From: SebastienBtr Date: Sat, 7 Nov 2020 16:21:57 +0100 Subject: [PATCH] update gateway config --- services/api-gateway/krakend.json | 17 ++---- services/api-gateway/settings/auth.json | 31 ++++++++++ services/api-gateway/settings/user.json | 76 +++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 12 deletions(-) create mode 100644 services/api-gateway/settings/auth.json create mode 100644 services/api-gateway/settings/user.json diff --git a/services/api-gateway/krakend.json b/services/api-gateway/krakend.json index 0712e20..49c14b3 100644 --- a/services/api-gateway/krakend.json +++ b/services/api-gateway/krakend.json @@ -47,17 +47,10 @@ } }, "endpoints": [ - { - { template "endpoint.tmpl" .article - } - }, - { - { template "endpoint.tmpl" .cart - } - }, - { - { template "endpoint.tmpl" .documentation - } - } + {{ template "endpoint.tmpl" .auth }}, + {{ template "endpoint.tmpl" .user }}, + {{ template "endpoint.tmpl" .article }}, + {{ template "endpoint.tmpl" .cart}}, + {{ template "endpoint.tmpl" .documentation}} ] } \ No newline at end of file diff --git a/services/api-gateway/settings/auth.json b/services/api-gateway/settings/auth.json new file mode 100644 index 0000000..4e97397 --- /dev/null +++ b/services/api-gateway/settings/auth.json @@ -0,0 +1,31 @@ +{ + "hosts": [ + "http://auth_app_1:3500" + ], + "endpoints": [ + { + "endpoint": "/auth/login", + "method": "POST", + "url_pattern": "/auth/login", + "encoding": "json", + "extra_config": { + "github.com/devopsfaith/krakend-jose/signer": { + "alg": "HS256", + "kid": "micro-express", + "keys-to-sign": [ + "accessToken" + ], + "jwk-url": "http://auth_app_1:3500/symmetric.json", + "disable_jwk_security": true + } + } + }, + { + "endpoint": "/auth/sign-up", + "method": "PUT", + "url_pattern": "/auth/sign-up", + "encoding": "no-op", + "extra_config": {} + } + ] +} \ No newline at end of file diff --git a/services/api-gateway/settings/user.json b/services/api-gateway/settings/user.json new file mode 100644 index 0000000..8758c29 --- /dev/null +++ b/services/api-gateway/settings/user.json @@ -0,0 +1,76 @@ +{ + "hosts": [ + "http://user_app_1:3500" + ], + "endpoints": [ + { + "endpoint": "/users", + "method": "GET", + "url_pattern": "/users", + "encoding": "no-op", + "extra_config": { + "github.com/devopsfaith/krakend-jose/validator": { + "alg": "HS256", + "jwk-url": "http://auth_app_1:3500/symmetric.json", + "disable_jwk_security": true + } + } + }, + { + "endpoint": "/users/{id}", + "method": "GET", + "url_pattern": "/users/{id}", + "encoding": "no-op", + "extra_config": { + "github.com/devopsfaith/krakend-jose/validator": { + "alg": "HS256", + "jwk-url": "http://auth_app_1:3500/symmetric.json", + "disable_jwk_security": true + } + } + }, + { + "endpoint": "/users/{id}", + "method": "PUT", + "url_pattern": "/users/{id}", + "encoding": "no-op", + "extra_config": { + "github.com/devopsfaith/krakend-jose/validator": { + "alg": "HS256", + "jwk-url": "http://auth_app_1:3500/symmetric.json", + "disable_jwk_security": true + } + } + }, + { + "endpoint": "/users/{id}", + "method": "DELETE", + "url_pattern": "/users/{id}", + "encoding": "no-op", + "extra_config": { + "github.com/devopsfaith/krakend-jose/validator": { + "alg": "HS256", + "roles_key": "roles", + "roles": [ + "manager" + ], + "jwk-url": "http://auth_app_1:3500/symmetric.json", + "disable_jwk_security": true + } + } + }, + { + "endpoint": "/users/{id}/password", + "method": "PUT", + "url_pattern": "/users/{id}/password", + "encoding": "no-op", + "extra_config": { + "github.com/devopsfaith/krakend-jose/validator": { + "alg": "HS256", + "jwk-url": "http://auth_app_1:3500/symmetric.json", + "disable_jwk_security": true + } + } + } + ] +} \ No newline at end of file