Ingress and security

This commit is contained in:
Siarhei_Sialitski 2023-01-08 11:24:08 +01:00
parent d60be0ccaa
commit 10f9ecc038
4 changed files with 355 additions and 298 deletions

View File

@ -37,6 +37,19 @@ static_resources:
route: route:
auto_host_rewrite: true auto_host_rewrite: true
cluster: catalog cluster: catalog
- name: "cp-short"
match:
prefix: "/cp/"
route:
auto_host_rewrite: true
prefix_rewrite: "/coupon-api/"
cluster: coupon
- name: "cp-long"
match:
prefix: "/coupon-api/"
route:
auto_host_rewrite: true
cluster: coupon
- name: "o-short" - name: "o-short"
match: match:
prefix: "/o/" prefix: "/o/"
@ -106,6 +119,19 @@ static_resources:
socket_address: socket_address:
address: catalog-api address: catalog-api
port_value: 80 port_value: 80
- name: coupon
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
load_assignment:
cluster_name: coupon
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: coupon-api
port_value: 80
- name: basket - name: basket
connect_timeout: 0.25s connect_timeout: 0.25s
type: strict_dns type: strict_dns

View File

@ -37,6 +37,19 @@ static_resources:
route: route:
auto_host_rewrite: true auto_host_rewrite: true
cluster: catalog cluster: catalog
- name: "cp-short"
match:
prefix: "/cp/"
route:
auto_host_rewrite: true
prefix_rewrite: "/coupon-api/"
cluster: coupon
- name: "cp-long"
match:
prefix: "/coupon-api/"
route:
auto_host_rewrite: true
cluster: coupon
- name: "o-short" - name: "o-short"
match: match:
prefix: "/o/" prefix: "/o/"
@ -109,6 +122,19 @@ static_resources:
socket_address: socket_address:
address: catalog-api address: catalog-api
port_value: 80 port_value: 80
- name: coupon
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
load_assignment:
cluster_name: coupon
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: coupon-api
port_value: 80
- name: basket - name: basket
connect_timeout: 0.25s connect_timeout: 0.25s
type: strict_dns type: strict_dns

View File

@ -15,6 +15,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
new ApiResource("webshoppingagg", "Web Shopping Aggregator"), new ApiResource("webshoppingagg", "Web Shopping Aggregator"),
new ApiResource("orders.signalrhub", "Ordering Signalr Hub"), new ApiResource("orders.signalrhub", "Ordering Signalr Hub"),
new ApiResource("webhooks", "Webhooks registration Service"), new ApiResource("webhooks", "Webhooks registration Service"),
new ApiResource("coupon", "Coupon Service"),
}; };
} }
@ -53,7 +54,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
"basket", "basket",
"webshoppingagg", "webshoppingagg",
"orders.signalrhub", "orders.signalrhub",
"webhooks" "webhooks",
"coupon"
}, },
}, },
new Client new Client
@ -79,7 +81,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
"orders", "orders",
"basket", "basket",
"mobileshoppingagg", "mobileshoppingagg",
"webhooks" "webhooks",
"coupon"
}, },
//Allow requesting refresh tokens for long lived API access //Allow requesting refresh tokens for long lived API access
AllowOfflineAccess = true, AllowOfflineAccess = true,
@ -117,7 +120,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
"basket", "basket",
"webshoppingagg", "webshoppingagg",
"orders.signalrhub", "orders.signalrhub",
"webhooks" "webhooks",
"coupon"
}, },
AccessTokenLifetime = 60*60*2, // 2 hours AccessTokenLifetime = 60*60*2, // 2 hours
IdentityTokenLifetime= 60*60*2 // 2 hours IdentityTokenLifetime= 60*60*2 // 2 hours
@ -183,7 +187,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
"orders", "orders",
"basket", "basket",
"webshoppingagg", "webshoppingagg",
"webhooks" "webhooks",
"coupon"
}, },
}, },
new Client new Client

View File

@ -82,7 +82,7 @@ export class SecurityService {
let client_id = 'js'; let client_id = 'js';
let redirect_uri = location.origin + '/'; let redirect_uri = location.origin + '/';
let response_type = 'id_token token'; let response_type = 'id_token token';
let scope = 'openid profile orders basket webshoppingagg orders.signalrhub'; let scope = 'openid profile orders basket webshoppingagg orders.signalrhub coupon';
let nonce = 'N' + Math.random() + '' + Date.now(); let nonce = 'N' + Math.random() + '' + Date.now();
let state = Date.now() + '' + Math.random(); let state = Date.now() + '' + Math.random();