Skip to content

Commit d8a0d9b

Browse files
author
Carlos Cañizares Estévez
committed
BasketApi: Add authorizationHeader (pass bearer from Swagger Ui to authorize request...).
MVC: Solve some design feedback (filter selector in catalog) CatalogApi: Move models from infrastructure to Model folder.
1 parent 17ee5d5 commit d8a0d9b

12 files changed

Lines changed: 9044 additions & 16 deletions

File tree

add-firewall-docker.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
param([switch]$Elevated)
2+
function Check-Admin {
3+
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
4+
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
5+
}
6+
if ((Check-Admin) -eq $false) {
7+
if ($elevated)
8+
{
9+
# could not elevate, quit
10+
}
11+
12+
else {
13+
14+
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition))
15+
}
16+
exit
17+
}
18+
$reglas = Get-NetFirewallRule -DisplayName 'EshopDocker'
19+
if ($reglas.Length -gt 0)
20+
{
21+
New-NetFirewallRule -DisplayName EshopDocker -Confirm -Description "Eshop on Containers" -LocalAddress Any -LocalPort Any -Protocol tcp -RemoteAddress Any -RemotePort 5100-5105 -Direction Inbound
22+
New-NetFirewallRule -DisplayName EshopDocker -Confirm -Description "Eshop on Containers" -LocalAddress Any -LocalPort Any -Protocol tcp -RemoteAddress Any -RemotePort 5100-5105 -Direction Outbound
23+
}

docker-compose.override.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,31 @@ services:
1414
- CatalogUrl=http://catalog.api
1515
- OrderingUrl=http://ordering.api:5102
1616
#- IdentityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105.
17-
#- IdentityUrl=http://10.0.75.1:5105 #Local: You need to open windows firewall at range 5100-5105.
18-
- IdentityUrl=http://identity.service:5105 #Local: You need a entry in windows host file to run identity in local docker.
17+
- IdentityUrl=http://10.0.75.1:5105 #Local: You need to open windows firewall at range 5100-5105.
18+
#- IdentityUrl=http://identity.service:5105 #Local: You need a entry in windows host file to run identity in local docker.
1919
- BasketUrl=http://basket.api:5103
2020
ports:
2121
- "5100:5100"
22+
links:
23+
- identity.service:10.0.75.1
2224

2325
webspa:
2426
environment:
2527
- CatalogUrl=http://catalog.api
2628
- OrderingUrl=http://ordering.api
27-
#- IdentityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105.
28-
- IdentityUrl=http://identity.service:5105 #Local: You need a entry in windows host file to run identity in local docker.
29-
- BasketUrl=http://basket.api:5103
29+
#- IdentityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105.
30+
#- IdentityUrl=http://identity.service:5105 #Local: You need a entry in windows host file to run identity in local docker.
31+
- IdentityUrl=http://10.0.75.1:5105 #Local: You need to open windows firewall at range 5100-5105.
32+
- BasketUrl=http://basket.api:5103
3033
ports:
3134
- "5104:80"
3235

3336
basket.api:
3437
environment:
3538
- ConnectionString=basket.data
3639
#- identityUrl=http://13.88.8.119:5105 #Remote
37-
- identityUrl=http://identity.service:5105 #Local: You need a entry in windows host file to run identity in local docker.
40+
#- identityUrl=http://identity.service:5105 #Local: You need a entry in windows host file to run identity in local docker.
41+
- identityUrl=http://10.0.75.1:5105 #Local: You need to open windows firewall at range 5100-5105.
3842
ports:
3943
- "5103:5103"
4044

@@ -47,18 +51,19 @@ services:
4751
ordering.api:
4852
environment:
4953
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
50-
- identityUrl=http://identity.service:5105 #local
51-
#- identityUrl=http://13.88.8.119:5105 #remote
54+
#- identityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105.
55+
#- identityUrl=http://identity.service:5105 #Local: You need a entry in windows host file to run identity in local docker.
56+
- identityUrl=http://10.0.75.1:5105 #Local: You need to open windows firewall at range 5100-5105.
5257
ports:
5358
- "5102:5102"
5459

5560
identity.service:
5661
environment:
5762
- SpaClient=http://localhost:5104
5863
- ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word
59-
#- MvcClient=http://13.88.8.119:5100 #Remote: VM Needs to have public access at 5105.
64+
#- MvcClient=http://13.88.8.119:5100 #Remote: VM Needs to have public access at 5105.
6065
- MvcClient=http://localhost:5100 #Local: You need a entry in windows host file to run identity in local docker.
61-
#10.0.75.1:5105 CCE/TODO: try to avoid host entry.
66+
- MvcClient=http://10.0.75.1:5100 #Local: You need to open windows firewall at range 5100-5105.
6267
ports:
6368
- "5105:5105"
6469

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
(function ($, swaggerUi) {
2+
$(function () {
3+
var settings = {
4+
authority: 'https://localhost:5105',
5+
client_id: 'js',
6+
popup_redirect_uri: window.location.protocol
7+
+ '//'
8+
+ window.location.host
9+
+ '/tokenclient/popup.html',
10+
11+
response_type: 'id_token token',
12+
scope: 'openid profile basket',
13+
14+
filter_protocol_claims: true
15+
},
16+
manager = new OidcTokenManager(settings),
17+
$inputApiKey = $('#input_apiKey');
18+
19+
$inputApiKey.on('dblclick', function () {
20+
manager.openPopupForTokenAsync()
21+
.then(function () {
22+
$inputApiKey.val(manager.access_token).change();
23+
}, function (error) {
24+
console.error(error);
25+
});
26+
});
27+
});
28+
})(jQuery, window.swaggerUi);

0 commit comments

Comments
 (0)