-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Servicing release for dotnet-aspnet-codegenerator and dotnet-msidenti…
…ty (#1816) * Code updates for blazor server Downstream API option (#1767) * Add blazor server, and some code refactors * updating System package versions due to security vulnerabilities (#1781) * updating System package versions due to security vulnerabilities * revert package version for test. * potential fix? * fixed all compliance issues. * clean up * Refactor ProjectModifier and remove calls to Directory.EnumerateFiles (#1782) * Removing EnumerateDirectories, other refactors * Create and Update Blazor Wasm App Registrations (#1793) * scripts and gitignore * Update redirect uris * create and update Blazor Wasm apps * Process callback paths for remote URIs * Add comments and refactor for better readability * String updates * Fix updating bug, update strings * Blazor Server: Code updates for Microsoft Graph and Downstream API options (#1798) Adding code updates for blazor server non-auth templates * Blazor Wasm: Code Updates and AppSettings updates (#1805) * Blazor Wasm: Code Updates and AppSettings updates * App Settings and Code Modification updates * App Settings and Code Modification updates * App Settings and Code Modification updates * App Settings and Code Modification updates * Update AzureAdProperties logic Address PR comments Refactor tests * Update version to 1.0.2, add reference to Nuget package * Refactor projectDescriptionReader logic * Downstream API fixes * Add AppSettings modification to CodeUpdate option * not throwing exception on invalid bootstrap versions. (#1814) * not throwing exception on invalid bootstrap . * minor fix * bump up dotnet-aspnet-codegenerator version. Co-authored-by: zahalzel <[email protected]>
- Loading branch information
1 parent
75892f6
commit 1abb136
Showing
51 changed files
with
1,777 additions
and
912 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"tools": { | ||
"dotnet": "6.0.100-rc.1.21430.12" | ||
"dotnet": "6.0.101" | ||
}, | ||
"msbuild-sdks": { | ||
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21552.1" | ||
}, | ||
"sdk": { | ||
"version": "6.0.100-rc.1.21430.12", | ||
"version": "6.0.101", | ||
"allowPrerelease": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 24 additions & 13 deletions
37
...tityScaffolding/Microsoft.DotNet.MSIdentity/AuthenticationParameters/AzureAdProperties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Microsoft.DotNet.MSIdentity.AuthenticationParameters | ||
{ | ||
public class AzureAdProperties | ||
public class PropertyNames | ||
{ | ||
public string? Domain { get; set; } | ||
public string? TenantId { get; set; } | ||
public string? ClientId { get; set; } | ||
public string? ClientSecret { get; set; } | ||
public string? CallbackPath { get; set; } | ||
public string? Instance { get; set; } | ||
public const string Domain = nameof(Domain); | ||
public const string TenantId = nameof(TenantId); | ||
public const string ClientId = nameof(ClientId); | ||
public const string ClientSecret = nameof(ClientSecret); | ||
public const string ClientCertificates = nameof(ClientCertificates); | ||
public const string CallbackPath = nameof(CallbackPath); | ||
public const string Instance = nameof(Instance); | ||
|
||
public const string Authority = nameof(Authority); | ||
public const string ValidateAuthority = nameof(ValidateAuthority); | ||
|
||
public const string BaseUrl = nameof(BaseUrl); | ||
public const string Scopes = nameof(Scopes); | ||
} | ||
|
||
//getting default properties from https://github.com/dotnet/aspnetcore/blob/6bc4b79f4ee7af00edcbb435e5ee4c1de349a110/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/appsettings.json | ||
public static class AzureAdDefaultProperties | ||
// getting default properties from | ||
// https://github.com/dotnet/aspnetcore/blob/6bc4b79f4ee7af00edcbb435e5ee4c1de349a110/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/appsettings.json | ||
public static class DefaultProperties | ||
{ | ||
public const string Domain = "qualified.domain.name"; | ||
public const string TenantId = "22222222-2222-2222-2222-222222222222"; | ||
public const string ClientId = "11111111-1111-1111-11111111111111111"; | ||
public const string Instance = "https://login.microsoftonline.com/"; | ||
public const string CallbackPath = "/signin-oidc"; | ||
public const string ClientSecret = "Client secret from app-registration. Check user secrets/azure portal."; | ||
|
||
public const string Authority = "https://login.microsoftonline.com/22222222-2222-2222-2222-222222222222"; | ||
public const string ValidateAuthority = "true"; | ||
|
||
public const string MicrosoftGraphBaseUrl = "https://graph.microsoft.com/v1.0"; | ||
public const string MicrosoftGraphScopes = "user.read"; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...ing/Microsoft.DotNet.MSIdentity/CodeReaderWriter/CodeFiles/Blazor/Server/CallWebApi.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@page "/callwebapi" | ||
|
||
@using Microsoft.Identity.Web | ||
|
||
@inject IDownstreamWebApi downstreamAPI | ||
@inject MicrosoftIdentityConsentAndConditionalAccessHandler ConsentHandler | ||
|
||
<h1>Call an API</h1> | ||
|
||
<p>This component demonstrates fetching data from a Web API.</p> | ||
|
||
@if (apiResult == null) | ||
{ | ||
<p><em>Loading...</em></p> | ||
} | ||
else | ||
{ | ||
<h2>API Result</h2> | ||
@apiResult | ||
} | ||
|
||
@code { | ||
private HttpResponseMessage response; | ||
private string apiResult; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
try | ||
{ | ||
response = await downstreamAPI.CallWebApiForUserAsync( | ||
"DownstreamApi", | ||
options => options.RelativePath = ""); | ||
|
||
if (response.StatusCode == System.Net.HttpStatusCode.OK) | ||
{ | ||
apiResult = await response.Content.ReadAsStringAsync(); | ||
} | ||
else | ||
{ | ||
apiResult = "Failed to call the web API"; | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
ConsentHandler.HandleException(ex); | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...g/Microsoft.DotNet.MSIdentity/CodeReaderWriter/CodeFiles/Blazor/Server/LoginDisplay.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<AuthorizeView> | ||
<Authorized> | ||
Hello, @context.User.Identity?.Name! | ||
<a href="MicrosoftIdentity/Account/SignOut">Log out</a> | ||
</Authorized> | ||
<NotAuthorized> | ||
<a href="MicrosoftIdentity/Account/SignIn">Log in</a> | ||
</NotAuthorized> | ||
</AuthorizeView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...g/Microsoft.DotNet.MSIdentity/CodeReaderWriter/CodeFiles/Blazor/wasm/Authentication.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@page "/authentication/{action}" | ||
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication | ||
<RemoteAuthenticatorView Action="@Action" /> | ||
|
||
@code{ | ||
[Parameter] public string? Action { get; set; } | ||
} |
23 changes: 23 additions & 0 deletions
23
...ing/Microsoft.DotNet.MSIdentity/CodeReaderWriter/CodeFiles/Blazor/wasm/LoginDisplay.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@using Microsoft.AspNetCore.Components.Authorization | ||
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication | ||
|
||
@inject NavigationManager Navigation | ||
@inject SignOutSessionStateManager SignOutManager | ||
|
||
<AuthorizeView> | ||
<Authorized> | ||
Hello, @context.User.Identity?.Name! | ||
<button class="nav-link btn btn-link" @onclick="BeginLogout">Log out</button> | ||
</Authorized> | ||
<NotAuthorized> | ||
<a href="authentication/login">Log in</a> | ||
</NotAuthorized> | ||
</AuthorizeView> | ||
|
||
@code{ | ||
private async Task BeginLogout(MouseEventArgs args) | ||
{ | ||
await SignOutManager.SetSignOutState(); | ||
Navigation.NavigateTo("authentication/logout"); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
.../Microsoft.DotNet.MSIdentity/CodeReaderWriter/CodeFiles/Blazor/wasm/RedirectToLogin.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@inject NavigationManager Navigation | ||
|
||
@code { | ||
protected override void OnInitialized() | ||
{ | ||
Navigation.NavigateTo($"authentication/login?returnUrl={Uri.EscapeDataString(Navigation.Uri)}"); | ||
} | ||
} |
Oops, something went wrong.