Skip to content

Commit a0182f0

Browse files
authored
Fix templates (#36255)
1 parent 4f8ad21 commit a0182f0

File tree

8 files changed

+168
-13
lines changed

8 files changed

+168
-13
lines changed

eng/Versions.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@
231231
<DuendeIdentityServerStorageVersion>5.2.0</DuendeIdentityServerStorageVersion>
232232
<DuendeIdentityServerEntityFrameworkStorageVersion>5.2.0</DuendeIdentityServerEntityFrameworkStorageVersion>
233233
<MessagePackVersion>2.1.90</MessagePackVersion>
234-
<MicrosoftIdentityWebVersion>1.14.1</MicrosoftIdentityWebVersion>
235-
<MicrosoftIdentityWebMicrosoftGraphVersion>1.1.0</MicrosoftIdentityWebMicrosoftGraphVersion>
236-
<MicrosoftIdentityWebUIVersion>1.1.0</MicrosoftIdentityWebUIVersion>
234+
<MicrosoftIdentityWebVersion>1.16.0</MicrosoftIdentityWebVersion>
235+
<MicrosoftIdentityWebMicrosoftGraphVersion>1.16.0</MicrosoftIdentityWebMicrosoftGraphVersion>
236+
<MicrosoftIdentityWebUIVersion>1.16.0</MicrosoftIdentityWebUIVersion>
237237
<MessagePackAnalyzerVersion>$(MessagePackVersion)</MessagePackAnalyzerVersion>
238238
<MoqVersion>4.10.0</MoqVersion>
239239
<MonoCecilVersion>0.11.2</MonoCecilVersion>

src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/.template.config/template.json

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,61 @@
220220
"Server/Models/ApplicationUser.cs",
221221
"Server/Readme.txt"
222222
]
223+
},
224+
{
225+
"condition": "(!GenerateApi)",
226+
"exclude": [
227+
"Client/Pages/CallWebApi.razor",
228+
"Server/Controllers/CallWebApiController.cs"
229+
]
230+
},
231+
{
232+
"condition": "(!GenerateGraph)",
233+
"exclude": [
234+
"Client/Shared/NavMenu.CallsMicrosoftGraph.razor",
235+
"Client/Pages/ShowProfile.razor",
236+
"Server/Controllers/ShowProfileController.cs"
237+
]
238+
},
239+
{
240+
"condition": "(!GenerateApiOrGraph && Hosted)",
241+
"rename": {
242+
"Client/Shared/NavMenu.NoGraphOrApi.razor": "Client/Shared/NavMenu.razor"
243+
},
244+
"exclude": [
245+
"Client/Shared/NavMenu.CallsMicrosoftGraph.razor",
246+
"Client/Shared/NavMenu.CallsWebApi.razor"
247+
]
248+
},
249+
{
250+
"condition": "(!GenerateApiOrGraph && !Hosted)",
251+
"rename": {
252+
"Client/Shared/NavMenu.NoGraphOrApi.razor": "Shared/NavMenu.razor"
253+
},
254+
"exclude": [
255+
"Client/Shared/NavMenu.CallsMicrosoftGraph.razor",
256+
"Client/Shared/NavMenu.CallsWebApi.razor"
257+
]
258+
},
259+
{
260+
"condition": "(GenerateGraph)",
261+
"rename": {
262+
"Client/Shared/NavMenu.CallsMicrosoftGraph.razor": "Client/Shared/NavMenu.razor"
263+
},
264+
"exclude": [
265+
"Client/Shared/NavMenu.NoGraphOrApi.razor",
266+
"Client/Shared/NavMenu.CallsWebApi.razor"
267+
]
268+
},
269+
{
270+
"condition": "(GenerateApi)",
271+
"rename": {
272+
"Client/Shared/NavMenu.CallsWebApi.razor": "Client/Shared/NavMenu.razor"
273+
},
274+
"exclude": [
275+
"Client/Shared/NavMenu.NoGraphOrApi.razor",
276+
"Client/Shared/NavMenu.CallsMicrosoftGraph.razor"
277+
]
223278
}
224279
]
225280
}
@@ -527,11 +582,11 @@
527582
},
528583
"GenerateApi": {
529584
"type": "computed",
530-
"value": "(( (IndividualB2CAuth && !Hosted) || OrganizationalAuth) && (CalledApiUrl != \"https://graph.microsoft.com/v1.0\" || CalledApiScopes != \"user.read\"))"
585+
"value": "(( (IndividualB2CAuth && !Hosted) || (OrganizationalAuth && Hosted)) && (CalledApiUrl != \"https://graph.microsoft.com/v1.0\" || CalledApiScopes != \"user.read\"))"
531586
},
532587
"GenerateGraph": {
533588
"type": "computed",
534-
"value": "(OrganizationalAuth && CallsMicrosoftGraph)"
589+
"value": "(OrganizationalAuth && CallsMicrosoftGraph && Hosted)"
535590
},
536591
"GenerateApiOrGraph": {
537592
"type": "computed",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<div class="top-row ps-3 navbar navbar-dark">
2+
<div class="container-fluid">
3+
<a class="navbar-brand" href="">ComponentsWebAssembly-CSharp</a>
4+
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
5+
<span class="navbar-toggler-icon"></span>
6+
</button>
7+
</div>
8+
</div>
9+
10+
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
11+
<nav class="flex-column">
12+
<div class="nav-item px-3">
13+
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
14+
<span class="oi oi-home" aria-hidden="true"></span> Home
15+
</NavLink>
16+
</div>
17+
<div class="nav-item px-3">
18+
<NavLink class="nav-link" href="counter">
19+
<span class="oi oi-plus" aria-hidden="true"></span> Counter
20+
</NavLink>
21+
</div>
22+
<div class="nav-item px-3">
23+
<NavLink class="nav-link" href="fetchdata">
24+
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
25+
</NavLink>
26+
</div>
27+
<div class="nav-item px-3">
28+
<NavLink class="nav-link" href="showProfile">
29+
<span class="oi oi-list-rich" aria-hidden="true"></span> Show Profile
30+
</NavLink>
31+
</div>
32+
</nav>
33+
</div>
34+
35+
@code {
36+
private bool collapseNavMenu = true;
37+
38+
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
39+
40+
private void ToggleNavMenu()
41+
{
42+
collapseNavMenu = !collapseNavMenu;
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<div class="top-row ps-3 navbar navbar-dark">
2+
<div class="container-fluid">
3+
<a class="navbar-brand" href="">ComponentsWebAssembly-CSharp</a>
4+
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
5+
<span class="navbar-toggler-icon"></span>
6+
</button>
7+
</div>
8+
</div>
9+
10+
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
11+
<nav class="flex-column">
12+
<div class="nav-item px-3">
13+
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
14+
<span class="oi oi-home" aria-hidden="true"></span> Home
15+
</NavLink>
16+
</div>
17+
<div class="nav-item px-3">
18+
<NavLink class="nav-link" href="counter">
19+
<span class="oi oi-plus" aria-hidden="true"></span> Counter
20+
</NavLink>
21+
</div>
22+
<div class="nav-item px-3">
23+
<NavLink class="nav-link" href="fetchdata">
24+
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
25+
</NavLink>
26+
</div>
27+
<div class="nav-item px-3">
28+
<NavLink class="nav-link" href="callwebapi">
29+
<span class="oi oi-list-rich" aria-hidden="true"></span> Call Web API
30+
</NavLink>
31+
</div>
32+
</nav>
33+
</div>
34+
35+
@code {
36+
private bool collapseNavMenu = true;
37+
38+
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
39+
40+
private void ToggleNavMenu()
41+
{
42+
collapseNavMenu = !collapseNavMenu;
43+
}
44+
}

src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/appsettings.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,21 @@
88
////#endif
99
// },
1010
////#elseif (IndividualB2CAuth)
11+
///*
12+
The following identity settings need to be configured
13+
before the project can be successfully executed.
14+
For more info see https:////aka.ms/dotnet-template-ms-identity-platform
15+
//*/
1116
// "AzureAdB2C": {
1217
// "Instance": "https:////aadB2CInstance.b2clogin.com/",
1318
// "ClientId": "11111111-1111-1111-11111111111111111",
1419
// "Domain": "qualified.domain.name",
1520
//#if (GenerateApi)
1621
// "ClientSecret": "secret-from-app-registration",
17-
// "Scopes": "api-scope",
1822
// "ClientCertificates" : [
1923
// ],
2024
//#endif
25+
// "Scopes": "api-scope",
2126
// "SignUpSignInPolicyId": "MySignUpSignInPolicyId"
2227
// },
2328
////#elseif (OrganizationalAuth)
@@ -40,11 +45,12 @@ For more info see https:////aka.ms/dotnet-template-ms-identity-platform
4045
// "ClientCertificates" : [
4146
// ],
4247
//#endif
48+
// "Scopes": "api-scope",
4349
// "CallbackPath": "/signin-oidc"
4450
// },
4551
////#endif
4652
////#if (GenerateApiOrGraph)
47-
// "DownstreamAPI": {
53+
// "DownstreamApi": {
4854
// /*
4955
// 'Scopes' contains space separated scopes of the Web API you want to call. This can be:
5056
// - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user)

src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/template.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@
101101
"AAdB2CInstance": {
102102
"type": "parameter",
103103
"datatype": "string",
104-
"defaultValue": "https://login.microsoftonline.com/tfp/",
105-
"replaces": "https:////login.microsoftonline.com/tfp/",
104+
"defaultValue": "https://qualified.domain.name.b2clogin.com/",
105+
"replaces": "https:////qualified.domain.name.b2clogin.com/",
106106
"description": "The Azure Active Directory B2C instance to connect to (use with IndividualB2C auth)."
107107
},
108108
"SignUpSignInPolicyId": {
109109
"type": "parameter",
110110
"datatype": "string",
111-
"defaultValue": "",
111+
"defaultValue": "b2c_1_susi",
112112
"replaces": "MySignUpSignInPolicyId",
113113
"description": "The sign-in and sign-up policy ID for this project (use with IndividualB2C auth)."
114114
},

src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/appsettings.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
{
22
////#if (IndividualB2CAuth)
3+
///*
4+
The following identity settings need to be configured
5+
before the project can be successfully executed.
6+
For more info see https:////aka.ms/dotnet-template-ms-identity-platform
7+
//*/
38
// "AzureAdB2C": {
4-
// "Instance": "https:////login.microsoftonline.com/tfp/",
9+
// "Instance": "https:////qualified.domain.name.b2clogin.com/",
510
// "ClientId": "11111111-1111-1111-11111111111111111",
611
// "Domain": "qualified.domain.name",
712
//#if (GenerateApi)
813
// "ClientSecret": "secret-from-app-registration",
9-
// "Scopes": "api-scope",
1014
// "ClientCertificates" : [
1115
// ],
1216
//#endif
17+
// "Scopes": "api-scope",
1318
// "SignUpSignInPolicyId": "MySignUpSignInPolicyId"
1419
// },
1520
////#elseif (OrganizationalAuth)
@@ -33,11 +38,12 @@ For more info see https:////aka.ms/dotnet-template-ms-identity-platform
3338
// "ClientCertificates" : [
3439
// ],
3540
//#endif
41+
// "Scopes": "api-scope",
3642
// "CallbackPath": "/signin-oidc"
3743
// },
3844
////#endif
3945
////#if (GenerateApiOrGraph)
40-
// "DownstreamAPI": {
46+
// "DownstreamApi": {
4147
// /*
4248
// 'Scopes' contains space separated scopes of the Web API you want to call. This can be:
4349
// - a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user)

0 commit comments

Comments
 (0)