This repository has been archived by the owner on Mar 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #41, Upgraded to .Net Core v3.2.0-preview1
- Loading branch information
Showing
21 changed files
with
293 additions
and
273 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,16 +1,53 @@ | ||
using Microsoft.AspNetCore.Blazor.Hosting; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using System.Text; | ||
using Microsoft.AspNetCore.Blazor.Hosting; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Blazor.Auth0; | ||
|
||
namespace Examples.AspNetCoreHosted.Client | ||
{ | ||
public static class Program | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
public static async Task Main(string[] args) | ||
{ | ||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
var builder = WebAssemblyHostBuilder.CreateDefault(args); | ||
|
||
builder.Services.AddBlazorAuth0(options => | ||
{ | ||
// Required | ||
options.Domain = "[Auth0_Domain]"; | ||
|
||
// Required | ||
options.ClientId = "[Auth0_Client_Id]"; | ||
|
||
//// Required if you want to make use of Auth0's RBAC | ||
options.Audience = "[Auth0_Audience]"; | ||
|
||
// PLEASE! PLEASE! PLEASE! DO NOT USE SECRETS IN CLIENT-SIDE APPS... https://medium.com/chingu/protect-application-assets-how-to-secure-your-secrets-a4165550c5fb | ||
// options.ClientSecret = "NEVER!!"; | ||
|
||
//// Uncomment the following line if you don't want your users to be automatically logged-off on token expiration | ||
// options.SlidingExpiration = true; | ||
|
||
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) => | ||
BlazorWebAssemblyHost.CreateDefaultBuilder() | ||
.UseBlazorStartup<Startup>(); | ||
//// Uncomment the following two lines if you want your users to log in via a pop-up window instead of being redirected | ||
// options.LoginMode = LoginModes.Popup; | ||
|
||
//// Uncomment the following line if you don't want your unauthenticated users to be automatically redirected to Auth0's Universal Login page | ||
// options.RequireAuthenticatedUser = false; | ||
}); | ||
|
||
// Policy based authorization, learn more here: https://docs.microsoft.com/en-us/aspnet/core/security/authorization/policies?view=aspnetcore-3.1 | ||
builder.Services.AddAuthorizationCore(options => | ||
{ | ||
options.AddPolicy("read:weather_forecast", policy => policy.RequireClaim("permissions", "read:weather_forecast")); | ||
options.AddPolicy("execute:increment_counter", policy => policy.RequireClaim("permissions", "execute:increment_counter")); | ||
}); | ||
|
||
builder.RootComponents.Add<App>("app"); | ||
|
||
await builder.Build().RunAsync(); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.