├── .gitignore ├── FirebaseFunApp ├── FirebaseAuthFunApp.csproj ├── FirebaseAuthFunApp.sln ├── FirebaseAuthFunction.cs └── host.json ├── README.md ├── TrailBlazor.sln └── TrailBlazor ├── App.razor ├── Helpers └── IJSRuntimeExtensionMethods.cs ├── Models ├── CurrentUser.cs ├── FirebaseUser.cs ├── FirebaseUserTokens.cs ├── LoginRequest.cs └── RegisterRequest.cs ├── Pages ├── Admin.razor ├── Auth │ ├── Login.razor │ └── Register.razor ├── FetchData.razor └── Index.razor ├── Program.cs ├── Properties └── launchSettings.json ├── Services └── StateProvider.cs ├── Shared ├── AuthLayout.razor ├── MainLayout.razor ├── MainLayout.razor.css ├── NavMenu.razor └── NavMenu.razor.css ├── TrailBlazor.csproj ├── _Imports.razor └── wwwroot ├── appsettings.json ├── css ├── app.css ├── bootstrap │ ├── bootstrap.min.css │ └── bootstrap.min.css.map └── open-iconic │ ├── FONT-LICENSE │ ├── ICON-LICENSE │ ├── README.md │ └── font │ ├── css │ └── open-iconic-bootstrap.min.css │ └── fonts │ ├── open-iconic.eot │ ├── open-iconic.otf │ ├── open-iconic.svg │ ├── open-iconic.ttf │ └── open-iconic.woff ├── favicon.ico ├── icon-512.png ├── img └── logo.png ├── index.html ├── js ├── alert.js └── firebaseFunctions.js ├── manifest.json ├── sample-data └── weather.json ├── service-worker.js └── service-worker.published.js /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Bb]uild/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # JustCode is a .NET coding add-in 131 | .JustCode 132 | 133 | # TeamCity is a build add-in 134 | _TeamCity* 135 | 136 | # DotCover is a Code Coverage Tool 137 | *.dotCover 138 | 139 | # AxoCover is a Code Coverage Tool 140 | .axoCover/* 141 | !.axoCover/settings.json 142 | 143 | # Visual Studio code coverage results 144 | *.coverage 145 | *.coveragexml 146 | 147 | # NCrunch 148 | _NCrunch_* 149 | .*crunch*.local.xml 150 | nCrunchTemp_* 151 | 152 | # MightyMoose 153 | *.mm.* 154 | AutoTest.Net/ 155 | 156 | # Web workbench (sass) 157 | .sass-cache/ 158 | 159 | # Installshield output folder 160 | [Ee]xpress/ 161 | 162 | # DocProject is a documentation generator add-in 163 | DocProject/buildhelp/ 164 | DocProject/Help/*.HxT 165 | DocProject/Help/*.HxC 166 | DocProject/Help/*.hhc 167 | DocProject/Help/*.hhk 168 | DocProject/Help/*.hhp 169 | DocProject/Help/Html2 170 | DocProject/Help/html 171 | 172 | # Click-Once directory 173 | publish/ 174 | 175 | # Publish Web Output 176 | *.[Pp]ublish.xml 177 | *.azurePubxml 178 | # Note: Comment the next line if you want to checkin your web deploy settings, 179 | # but database connection strings (with potential passwords) will be unencrypted 180 | *.pubxml 181 | *.publishproj 182 | 183 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 184 | # checkin your Azure Web App publish settings, but sensitive information contained 185 | # in these scripts will be unencrypted 186 | PublishScripts/ 187 | 188 | # NuGet Packages 189 | *.nupkg 190 | # NuGet Symbol Packages 191 | *.snupkg 192 | # The packages folder can be ignored because of Package Restore 193 | **/[Pp]ackages/* 194 | # except build/, which is used as an MSBuild target. 195 | !**/[Pp]ackages/build/ 196 | # Uncomment if necessary however generally it will be regenerated when needed 197 | #!**/[Pp]ackages/repositories.config 198 | # NuGet v3's project.json files produces more ignorable files 199 | *.nuget.props 200 | *.nuget.targets 201 | 202 | # Microsoft Azure Build Output 203 | csx/ 204 | *.build.csdef 205 | 206 | # Microsoft Azure Emulator 207 | ecf/ 208 | rcf/ 209 | 210 | # Windows Store app package directories and files 211 | AppPackages/ 212 | BundleArtifacts/ 213 | Package.StoreAssociation.xml 214 | _pkginfo.txt 215 | *.appx 216 | *.appxbundle 217 | *.appxupload 218 | 219 | # Visual Studio cache files 220 | # files ending in .cache can be ignored 221 | *.[Cc]ache 222 | # but keep track of directories ending in .cache 223 | !?*.[Cc]ache/ 224 | 225 | # Others 226 | ClientBin/ 227 | ~$* 228 | *~ 229 | *.dbmdl 230 | *.dbproj.schemaview 231 | *.jfm 232 | *.pfx 233 | *.publishsettings 234 | orleans.codegen.cs 235 | 236 | # Including strong name files can present a security risk 237 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 238 | #*.snk 239 | 240 | # Since there are multiple workflows, uncomment next line to ignore bower_components 241 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 242 | #bower_components/ 243 | 244 | # RIA/Silverlight projects 245 | Generated_Code/ 246 | 247 | # Backup & report files from converting an old project file 248 | # to a newer Visual Studio version. Backup files are not needed, 249 | # because we have git ;-) 250 | _UpgradeReport_Files/ 251 | Backup*/ 252 | UpgradeLog*.XML 253 | UpgradeLog*.htm 254 | ServiceFabricBackup/ 255 | *.rptproj.bak 256 | 257 | # SQL Server files 258 | *.mdf 259 | *.ldf 260 | *.ndf 261 | 262 | # Business Intelligence projects 263 | *.rdl.data 264 | *.bim.layout 265 | *.bim_*.settings 266 | *.rptproj.rsuser 267 | *- [Bb]ackup.rdl 268 | *- [Bb]ackup ([0-9]).rdl 269 | *- [Bb]ackup ([0-9][0-9]).rdl 270 | 271 | # Microsoft Fakes 272 | FakesAssemblies/ 273 | 274 | # GhostDoc plugin setting file 275 | *.GhostDoc.xml 276 | 277 | # Node.js Tools for Visual Studio 278 | .ntvs_analysis.dat 279 | node_modules/ 280 | 281 | # Visual Studio 6 build log 282 | *.plg 283 | 284 | # Visual Studio 6 workspace options file 285 | *.opt 286 | 287 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 288 | *.vbw 289 | 290 | # Visual Studio LightSwitch build output 291 | **/*.HTMLClient/GeneratedArtifacts 292 | **/*.DesktopClient/GeneratedArtifacts 293 | **/*.DesktopClient/ModelManifest.xml 294 | **/*.Server/GeneratedArtifacts 295 | **/*.Server/ModelManifest.xml 296 | _Pvt_Extensions 297 | 298 | # Paket dependency manager 299 | .paket/paket.exe 300 | paket-files/ 301 | 302 | # FAKE - F# Make 303 | .fake/ 304 | 305 | # CodeRush personal settings 306 | .cr/personal 307 | 308 | # Python Tools for Visual Studio (PTVS) 309 | __pycache__/ 310 | *.pyc 311 | 312 | # Cake - Uncomment if you are using it 313 | # tools/** 314 | # !tools/packages.config 315 | 316 | # Tabs Studio 317 | *.tss 318 | 319 | # Telerik's JustMock configuration file 320 | *.jmconfig 321 | 322 | # BizTalk build output 323 | *.btp.cs 324 | *.btm.cs 325 | *.odx.cs 326 | *.xsd.cs 327 | 328 | # OpenCover UI analysis results 329 | OpenCover/ 330 | 331 | # Azure Stream Analytics local run output 332 | ASALocalRun/ 333 | 334 | # MSBuild Binary and Structured Log 335 | *.binlog 336 | 337 | # NVidia Nsight GPU debugger configuration file 338 | *.nvuser 339 | 340 | # MFractors (Xamarin productivity tool) working folder 341 | .mfractor/ 342 | 343 | # Local History for Visual Studio 344 | .localhistory/ 345 | 346 | # BeatPulse healthcheck temp database 347 | healthchecksdb 348 | 349 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 350 | MigrationBackup/ 351 | 352 | # Ionide (cross platform F# VS Code tools) working folder 353 | .ionide/ 354 | 355 | 356 | # Custom 357 | _NuGetPackages/ 358 | _Config/ 359 | _Config.zip 360 | bwipjs-fonts/ 361 | Platform/ClientApp/dist/ 362 | *.ignore.config 363 | *.ignore.json 364 | *.Development.json 365 | local.settings.json 366 | vendor-manifest.json 367 | Platform/coverage/ 368 | PlatformCore/NRPlatformCore/ClientApp/coverage/ 369 | *.pubxml 370 | dist/ 371 | packages/ 372 | /Platform/.vscode/launch.json 373 | /Platform/ClientApp/.vscode/launch.json 374 | /NRPlatformHelpFunApp 375 | !*/System.Data.SqlClient.dll 376 | package-lock.json 377 | /PlatformCore/NRPlatformCore/ClientApp/build 378 | /FunAppsV3/NRPlatformHelpFunApp 379 | profile.arm.json 380 | /.idea/**/*.* 381 | /Random/AnandNRServiceTest/.idea/**/*.* 382 | *.trx 383 | site.css 384 | site.css.map 385 | ServiceDependencies/ 386 | serviceDependencies.json 387 | serviceDependencies.*.json -------------------------------------------------------------------------------- /FirebaseFunApp/FirebaseAuthFunApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netcoreapp3.1 4 | v3 5 | <_FunctionsSkipCleanOutput>true 6 | 9c9d448d-d2f6-4292-b343-d83f8a8a16dc 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | PreserveNewest 15 | 16 | 17 | PreserveNewest 18 | Never 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /FirebaseFunApp/FirebaseAuthFunApp.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31129.286 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FirebaseAuthFunApp", "FirebaseAuthFunApp.csproj", "{C2AD37EC-C221-4CCB-A989-692A7C32888D}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {C2AD37EC-C221-4CCB-A989-692A7C32888D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {C2AD37EC-C221-4CCB-A989-692A7C32888D}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {C2AD37EC-C221-4CCB-A989-692A7C32888D}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {C2AD37EC-C221-4CCB-A989-692A7C32888D}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {D81BDD1E-19FE-464B-AD79-053253CB0534} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /FirebaseFunApp/FirebaseAuthFunction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Microsoft.AspNetCore.Mvc; 4 | using Microsoft.Azure.WebJobs; 5 | using Microsoft.Azure.WebJobs.Extensions.Http; 6 | using Microsoft.AspNetCore.Http; 7 | using Microsoft.Extensions.Logging; 8 | using Newtonsoft.Json; 9 | using System.IdentityModel.Tokens.Jwt; 10 | 11 | namespace TestFunApp 12 | { 13 | public static class FirebaseAuthFunction 14 | { 15 | [FunctionName("FirebaseAuthFunction")] 16 | public static async Task Run( 17 | [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "auth")] Credentials credentials, HttpRequest req, 18 | ILogger log) 19 | { 20 | 21 | log.LogInformation("C# HTTP trigger function processed a request."); 22 | var ReqHeaders = req.Headers; 23 | ReqHeaders.TryGetValue("Authorization", out var token); 24 | var TokenFromHeader = token; 25 | 26 | // code below kept in case we want to pull from body instead of header 27 | // string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); 28 | // var TokenFromRequest = JsonConvert.DeserializeObject(requestBody); 29 | // var TokenFromBody = credentials.Token; 30 | 31 | var JWTHandler = new JwtSecurityTokenHandler(); 32 | var JWTToken = JWTHandler.ReadToken(TokenFromHeader); 33 | var ExpDate = JWTToken.ValidTo; 34 | if (ExpDate < DateTime.UtcNow.AddMinutes(1)) 35 | { 36 | return new UnauthorizedResult(); 37 | } 38 | else 39 | { 40 | return new OkObjectResult("Valid!"); // {credentials.Token} 41 | } 42 | 43 | } 44 | } 45 | public class Credentials 46 | { 47 | public string Token { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /FirebaseFunApp/host.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "functionTimeout": "00:10:00", 4 | "logging": { 5 | "applicationInsights": { 6 | "samplingExcludedTypes": "Request", 7 | "samplingSettings": { 8 | "isEnabled": true 9 | } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TrailBlazor: Blazor Standalone WASM with Firebase Authentication 2 | ## By Chelsea Becker and Eric Endsley, 4/27/21 3 | 4 | ## Introduction/Project Overview 5 | This project was developed by Netrush interns in Spring of 2021 for the purpose of demonstrating authentication with Firebase and in a standalone client-side Blazor Web-Assembly App. The application succesfully utilizes JSInterop to makes calls to Firebase authentication service, and returns Firebase user data to a custom AuthStateProvider which authorizes that user with the Identity functionality built into Blazor pages (e.g. AuthorizeView, UserRoles, @context.Identity, et cetera). Currently the only login route uses email and password with no email verification, but other Firebase auth routes should be easy to integrate following the Firebase documentation. JWT tokens generated by Firebase are stored in 'Blazored' LocalStorage which may then be used to further authenticate the users call to other APIs and services. 6 | 7 | The app runs a timer to automatically refresh and store a new Firebase ID token for an authenticated user prior to the token's expiration, every 50 minutes. There is a button on the main landing page which automatically triggers this refresh functionality and stores a new token on cilck. The page also runs a timer to automatically sign a user out and expire their authenication after a specified period of time. The page includes a hardcoded demonstration of an "Admin" user role, which assigns an Admin user role claim to a Firebase user with a specified uid (this uid is hardcoded and corresponds to a user with firebase login info {email: "testchel@gmail.com", password: "Blahblah1@" }), and enables this user to view an Admin page that other users cannot access. In practice the hard-coded process to check uid would be replaced with a database query, for example to NRDB. 8 | 9 | ## Languages & Technologies Used 10 | * Blazor Web Assembly 11 | * .NET 5.0 (TrailBlazor) and .NET Core 3.1 (FirebaseFunApp) 12 | * C# 13 | * JavaScript 14 | * Firebase 15 | * Blazored Local Storage 16 | * RadZen 17 | * Bootstrap (from Blazor template) 18 | 19 | ## Setup 20 | Before using the application, replace the Firebase config secrets in index.html with a new Firebase account. 21 | 22 | ## What Works Best 23 | * Using a custom AuthStateProvider which recieves data from a successful call to Firebase 24 | * Using 'Blazored' local storage to pass values accross application (tokens and userId) 25 | 26 | ## Things We Tried That Didn't Work 27 | * Using Blazor WASM built-in auth (OIDC) 28 | * Checking tokens via Firestore (unnecessary because Netrush doesn't use Firestore) 29 | * Adding Firebase Admin Auth SDK (needed server-side startup.cs) 30 | * Passing ID & refresh token string values through static properties across application -- used Blazored Local Storage 31 | 32 | ## Things We Tried That Weren't Optimal 33 | * Custom authorization (ASP.NET hosted) using LocalDb 34 | * Attempting to sync userdata in a LocalDb to Firebase in a dual-auth scheme. 35 | -------------------------------------------------------------------------------- /TrailBlazor.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30907.101 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F9186D31-B1C9-4B92-801F-04AA976701EF}" 7 | ProjectSection(SolutionItems) = preProject 8 | .gitignore = .gitignore 9 | pull_request_template.md = pull_request_template.md 10 | EndProjectSection 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TrailBlazor", "TrailBlazor\TrailBlazor.csproj", "{97F3A495-634F-4611-8B38-21A26E49E26E}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {97F3A495-634F-4611-8B38-21A26E49E26E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {97F3A495-634F-4611-8B38-21A26E49E26E}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {97F3A495-634F-4611-8B38-21A26E49E26E}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {97F3A495-634F-4611-8B38-21A26E49E26E}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {9B091445-060A-447F-93C0-F0464FABFBA8} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /TrailBlazor/App.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Sorry, there's nothing at this address. 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /TrailBlazor/Helpers/IJSRuntimeExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Microsoft.JSInterop; 3 | 4 | namespace TrailBlazor.Helpers 5 | { 6 | #region Runtime Extension Methods 7 | public static class IJSRuntimeExtensionMethods 8 | { 9 | public static async ValueTask InitializeInactivityTimer(this IJSRuntime JS, 10 | DotNetObjectReference dotNetObjectReference) where T : class 11 | { 12 | await JS.InvokeVoidAsync("initializeInactivityTimer", dotNetObjectReference); 13 | } 14 | } 15 | #endregion 16 | } 17 | -------------------------------------------------------------------------------- /TrailBlazor/Models/CurrentUser.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace TrailBlazor.Models 4 | { 5 | public class CurrentUser 6 | { 7 | public static bool IsAuthenticated { get; set; } 8 | public static string UserName { get; set; } 9 | public Dictionary Claims { get; set; } 10 | public static string UserId { get; set; } 11 | public const string Uid = "EpVNlJlQ3Ra9m8Lw0Ie348BflZg1"; 12 | public const string Role = "Admin"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /TrailBlazor/Models/FirebaseUser.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace TrailBlazor.Models 4 | { 5 | public class FirebaseUser 6 | { 7 | public string Uid { get; set; } 8 | public object DisplayName { get; set; } 9 | public object PhotoURL { get; set; } 10 | public string Email { get; set; } 11 | public bool EmailVerified { get; set; } 12 | public object PhoneNumber { get; set; } 13 | public bool IsAnonymous { get; set; } 14 | public object TenantId { get; set; } 15 | public List ProviderData { get; set; } 16 | public string ApiKey { get; set; } 17 | public string AppName { get; set; } 18 | public string AuthDomain { get; set; } 19 | public StsTokenManager StsTokenManager { get; set; } 20 | public object RedirectEventId { get; set; } 21 | public string LastLoginAt { get; set; } 22 | public string CreatedAt { get; set; } 23 | public MultiFactor MultiFactor { get; set; } 24 | } 25 | 26 | public class ProviderData 27 | { 28 | public string Uid { get; set; } 29 | public object DisplayName { get; set; } 30 | public object PhotoURL { get; set; } 31 | public string Email { get; set; } 32 | public object PhoneNumber { get; set; } 33 | public string ProviderId { get; set; } 34 | } 35 | 36 | public class StsTokenManager 37 | { 38 | public string ApiKey { get; set; } 39 | public string RefreshToken { get; set; } 40 | public string AccessToken { get; set; } 41 | public long ExpirationTime { get; set; } 42 | } 43 | 44 | public class MultiFactor 45 | { 46 | public List EnrolledFactors { get; set; } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /TrailBlazor/Models/FirebaseUserTokens.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace TrailBlazor.Models 4 | { 5 | class FirebaseUserTokens 6 | { 7 | [JsonProperty("Access_Token")] 8 | public string AccessToken { get; set; } 9 | [JsonProperty("Expires_In")] 10 | public string ExpiresIn { get; set; } 11 | [JsonProperty("Token_Type")] 12 | public string TokenType { get; set; } 13 | [JsonProperty("Refresh_Token")] 14 | public string RefreshToken { get; set; } 15 | [JsonProperty("Id_Token")] 16 | public string IdToken { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TrailBlazor/Models/LoginRequest.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace TrailBlazor.Models 4 | { 5 | public class LoginRequest 6 | { 7 | [Required] 8 | public string UserName { get; set; } 9 | [Required] 10 | public string Password { get; set; } 11 | public bool RememberMe { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /TrailBlazor/Models/RegisterRequest.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace TrailBlazor.Models 4 | { 5 | public class RegisterRequest 6 | { 7 | [Required] 8 | public string UserName { get; set; } 9 | [Required] 10 | public string Password { get; set; } 11 | [Required] 12 | [Compare(nameof(Password), ErrorMessage = "Passwords do not match")] 13 | public string PasswordConfirm { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /TrailBlazor/Pages/Admin.razor: -------------------------------------------------------------------------------- 1 | @page "/admin" 2 | @inject IJSRuntime JS 3 | @attribute [Authorize(Roles = "Admin")] 4 | 5 | Welcome Admin! 6 | 7 | 8 | 9 | @foreach (var claim in context.User.Claims) 10 | { 11 | @claim.Type: @claim.Value 12 | } 13 | 14 | 15 | 16 | 17 | @code { 18 | async void OnClick() 19 | { 20 | await JS.InvokeVoidAsync("JSAlert"); 21 | } 22 | } -------------------------------------------------------------------------------- /TrailBlazor/Pages/Auth/Login.razor: -------------------------------------------------------------------------------- 1 | @page "/login" 2 | @layout AuthLayout 3 | @using Microsoft.JSInterop 4 | @using Newtonsoft.Json 5 | @using System.Timers; 6 | @inject NavigationManager navigationManager 7 | @inject Blazored.LocalStorage.ILocalStorageService localStorage 8 | @inject Blazored.LocalStorage.ISyncLocalStorageService getLocalStorage 9 | @inject StateProvider authStateProvider 10 | @inject IJSRuntime JS 11 | @using Radzen 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | @error 41 | 42 | Create account 43 | 44 | 45 | 46 | 47 | 48 | 49 | @code{ 50 | LoginRequest loginRequest { get; set; } = new LoginRequest(); 51 | CurrentUser currentUser { get; set; } = new CurrentUser(); 52 | string error { get; set; } 53 | bool popup; 54 | private static System.Timers.Timer aTimer { get; set; } 55 | FirebaseUserTokens firebaseUserTokens { get; set; } 56 | 57 | #region SubmissionHandlers 58 | 59 | async Task OnSubmit() 60 | { 61 | error = null; 62 | try 63 | { 64 | var result = await JS.InvokeAsync("firebaseEmailSignIn", loginRequest.UserName, loginRequest.Password); 65 | var userJSON = await JS.InvokeAsync("firebaseGetCurrentUser"); 66 | if (userJSON != null) 67 | { 68 | FirebaseUser user = JsonConvert.DeserializeObject(userJSON); 69 | CurrentUser.IsAuthenticated = true; 70 | CurrentUser.UserName = user.Email; 71 | await localStorage.SetItemAsync("userId", user.Uid); 72 | await localStorage.SetItemAsync("refreshToken", user.StsTokenManager.RefreshToken); 73 | await localStorage.SetItemAsync("accessToken", user.StsTokenManager.AccessToken); 74 | SetTimer(); 75 | authStateProvider.ManageUser(); 76 | navigationManager.NavigateTo(""); 77 | } 78 | else 79 | { 80 | error = result; 81 | } 82 | } 83 | catch (Exception ex) 84 | { 85 | error = ex.Message; 86 | } 87 | } 88 | 89 | void OnInvalidSubmit(FormInvalidSubmitEventArgs args) 90 | { 91 | error = "Invalid Submission"; 92 | } 93 | #endregion 94 | 95 | #region Timers 96 | public void SetTimer() 97 | { 98 | aTimer = new System.Timers.Timer(3000000); 99 | aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); 100 | aTimer.AutoReset = true; 101 | aTimer.Enabled = true; 102 | } 103 | 104 | public async void OnTimedEvent(object source, ElapsedEventArgs e) 105 | { 106 | if (CurrentUser.IsAuthenticated) 107 | { 108 | string refreshToken = getLocalStorage.GetItem("refreshToken"); 109 | var firebaseTokens = await JS.InvokeAsync("getRefreshToken", refreshToken); 110 | firebaseUserTokens = JsonConvert.DeserializeObject(firebaseTokens); 111 | await localStorage.SetItemAsync("refreshToken", firebaseUserTokens.RefreshToken); 112 | await localStorage.SetItemAsync("accessToken", firebaseUserTokens.AccessToken); 113 | Console.WriteLine("Tokens refreshed"); 114 | } 115 | else 116 | { 117 | aTimer.Stop(); 118 | } 119 | } 120 | #endregion 121 | } -------------------------------------------------------------------------------- /TrailBlazor/Pages/Auth/Register.razor: -------------------------------------------------------------------------------- 1 | @page "/register" 2 | @layout AuthLayout 3 | @using Radzen 4 | @using Newtonsoft.Json 5 | @inject IJSRuntime JS 6 | @inject NavigationManager navigationManager 7 | @inject StateProvider authStateProvider 8 | @inject Blazored.LocalStorage.ILocalStorageService localStorage 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | @error 48 | 49 | Already have an account? Click here to login 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | @code { 58 | RegisterRequest registerRequest { get; set; } = new RegisterRequest(); 59 | CurrentUser currentUser { get; set; } = new CurrentUser(); 60 | string error { get; set; } 61 | bool popup; 62 | 63 | async Task OnSubmit() 64 | { 65 | try 66 | { 67 | var result = await JS.InvokeAsync("firebaseCreateUser", registerRequest.UserName, registerRequest.Password); 68 | var userJSON = await JS.InvokeAsync("firebaseGetCurrentUser"); 69 | if (userJSON != null) 70 | { 71 | FirebaseUser user = JsonConvert.DeserializeObject(userJSON); 72 | CurrentUser.IsAuthenticated = true; 73 | CurrentUser.UserName = user.Email; 74 | await localStorage.SetItemAsync("user", currentUser); 75 | authStateProvider.ManageUser(); 76 | navigationManager.NavigateTo(""); 77 | } 78 | else 79 | { 80 | error = result; 81 | } 82 | } 83 | catch (Exception ex) 84 | { 85 | error = ex.Message; 86 | } 87 | } 88 | 89 | void OnInvalidSubmit(FormInvalidSubmitEventArgs args) 90 | { 91 | error = "Invalid Submission"; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /TrailBlazor/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | @inject HttpClient Http 3 | 4 | Weather forecast 5 | 6 | This component demonstrates fetching data from the server. 7 | 8 | @if (forecasts == null) 9 | { 10 | Loading... 11 | } 12 | else 13 | { 14 | 15 | 16 | 17 | Date 18 | Temp. (C) 19 | Temp. (F) 20 | Summary 21 | 22 | 23 | 24 | @foreach (var forecast in forecasts) 25 | { 26 | 27 | @forecast.Date.ToShortDateString() 28 | @forecast.TemperatureC 29 | @forecast.TemperatureF 30 | @forecast.Summary 31 | 32 | } 33 | 34 | 35 | } 36 | 37 | @code { 38 | private WeatherForecast[] forecasts; 39 | 40 | protected override async Task OnInitializedAsync() 41 | { 42 | forecasts = await Http.GetFromJsonAsync("sample-data/weather.json"); 43 | } 44 | 45 | public class WeatherForecast 46 | { 47 | public DateTime Date { get; set; } 48 | 49 | public int TemperatureC { get; set; } 50 | 51 | public string Summary { get; set; } 52 | 53 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /TrailBlazor/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @using Newtonsoft.Json 3 | @layout MainLayout 4 | @inject StateProvider authStateProvider 5 | @inject IJSRuntime JS 6 | @inject Blazored.LocalStorage.ISyncLocalStorageService getLocalStorage 7 | @inject Blazored.LocalStorage.ILocalStorageService localStorage 8 | 9 | 10 | 11 | Hello @context.User.Identity.Name! 12 | Welcome to the TrailBlazor authentication demo for Blazor 13 | 14 | 15 | 16 | Loading ... 17 | 18 | 19 | 20 | @code { 21 | 22 | public string refreshToken { get; set; } 23 | FirebaseUser firebaseUser { get; set; } 24 | FirebaseUserTokens firebaseUserTokens { get; set; } 25 | 26 | public async void GetNewToken() 27 | { 28 | refreshToken = getLocalStorage.GetItem("refreshToken"); 29 | string response = await JS.InvokeAsync("getRefreshToken", refreshToken); 30 | firebaseUserTokens = JsonConvert.DeserializeObject(response); 31 | string newRefreshToken = firebaseUserTokens.RefreshToken; 32 | string newAccessToken = firebaseUserTokens.AccessToken; 33 | await localStorage.SetItemAsync("refreshToken", newRefreshToken); 34 | await localStorage.SetItemAsync("accessToken", newAccessToken); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /TrailBlazor/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components.Authorization; 2 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using System; 5 | using System.Net.Http; 6 | using System.Threading.Tasks; 7 | using TrailBlazor.Services; 8 | using Blazored.LocalStorage; 9 | 10 | namespace TrailBlazor 11 | { 12 | public class Program 13 | { 14 | public static async Task Main(string[] args) 15 | { 16 | var builder = WebAssemblyHostBuilder.CreateDefault(args); 17 | builder.RootComponents.Add("#app"); 18 | 19 | builder.Services.AddOptions(); 20 | builder.Services.AddAuthorizationCore(); 21 | builder.Services.AddScoped(); 22 | builder.Services.AddScoped(s => s.GetRequiredService()); 23 | builder.Services.AddBlazoredLocalStorage(); 24 | builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); 25 | 26 | await builder.Build().RunAsync(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /TrailBlazor/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:13283", 7 | "sslPort": 44318 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "TrailBlazor": { 20 | "commandName": "Project", 21 | "dotnetRunMessages": "true", 22 | "launchBrowser": true, 23 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /TrailBlazor/Services/StateProvider.cs: -------------------------------------------------------------------------------- 1 | using Blazored.LocalStorage; 2 | using TrailBlazor.Models; 3 | using Microsoft.AspNetCore.Components.Authorization; 4 | using System; 5 | using System.Net.Http; 6 | using System.Security.Claims; 7 | using System.Threading.Tasks; 8 | using System.Collections.Generic; 9 | 10 | #region Region 11 | namespace TrailBlazor.Services 12 | { 13 | public class StateProvider : AuthenticationStateProvider 14 | { 15 | private readonly ILocalStorageService _localStorage; 16 | 17 | public StateProvider(ILocalStorageService localStorage) 18 | { 19 | _localStorage = localStorage; 20 | } 21 | 22 | public async override Task GetAuthenticationStateAsync() 23 | { 24 | var identity = new ClaimsIdentity(); 25 | try 26 | { 27 | if (CurrentUser.IsAuthenticated) 28 | { 29 | var _userId = await _localStorage.GetItemAsync("userId"); 30 | if (_userId == CurrentUser.Uid) 31 | { 32 | var claims = new List 33 | { 34 | new Claim(ClaimTypes.Name, CurrentUser.UserName), 35 | new Claim(ClaimTypes.Role, CurrentUser.Role) 36 | }; 37 | identity = new ClaimsIdentity(claims, "authentication"); 38 | return await Task.FromResult(new AuthenticationState(new ClaimsPrincipal(identity))); 39 | } 40 | else 41 | { 42 | var claims = new List 43 | { 44 | new Claim(ClaimTypes.Name, CurrentUser.UserName), 45 | new Claim(ClaimTypes.Role, "Basic User") 46 | }; 47 | identity = new ClaimsIdentity(claims, "authentication"); 48 | return await Task.FromResult(new AuthenticationState(new ClaimsPrincipal(identity))); 49 | } 50 | } 51 | } 52 | catch (HttpRequestException ex) 53 | { 54 | Console.WriteLine("Request failed:" + ex.ToString()); 55 | } 56 | AuthenticationState authState = new AuthenticationState(new ClaimsPrincipal(identity)); 57 | return authState; 58 | } 59 | 60 | public void ManageUser() 61 | { 62 | NotifyAuthenticationStateChanged(GetAuthenticationStateAsync()); 63 | } 64 | } 65 | } 66 | #endregion -------------------------------------------------------------------------------- /TrailBlazor/Shared/AuthLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | 4 | 5 | @Body 6 | 7 | -------------------------------------------------------------------------------- /TrailBlazor/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | @inject NavigationManager navigationManager 3 | @inject StateProvider authStateProvider 4 | @inject Blazored.LocalStorage.ILocalStorageService localStorage 5 | @inject IJSRuntime JS 6 | @using TrailBlazor.Helpers 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Hello, @context.User.Identity.Name! 16 | Logout 17 | 18 | 19 | @Body 20 | 21 | 22 | 23 | 24 | 25 | @code { 26 | [CascadingParameter] 27 | Task AuthenticationState { get; set; } 28 | 29 | protected override async Task OnInitializedAsync() 30 | { 31 | await JS.InitializeInactivityTimer(DotNetObjectReference.Create(this)); // pass an instance of MainLayout 32 | if (!(await AuthenticationState).User.Identity.IsAuthenticated) 33 | { 34 | navigationManager.NavigateTo("/login"); 35 | } 36 | } 37 | 38 | [JSInvokable] 39 | public async Task LogoutClick() 40 | { 41 | var signOutState = await JS.InvokeAsync("firebaseSignOut"); 42 | CurrentUser.UserName = null; 43 | CurrentUser.IsAuthenticated = signOutState; 44 | await localStorage.SetItemAsync("refreshToken", null); 45 | await localStorage.SetItemAsync("accessToken", null); 46 | authStateProvider.ManageUser(); 47 | navigationManager.NavigateTo("/login"); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /TrailBlazor/Shared/MainLayout.razor.css: -------------------------------------------------------------------------------- 1 | .page { 2 | position: relative; 3 | display: flex; 4 | flex-direction: column; 5 | } 6 | 7 | .main { 8 | flex: 1; 9 | } 10 | 11 | .sidebar { 12 | background-image: linear-gradient(180deg, rgb(236, 56, 64) 0%, #CE4551 70%); 13 | } 14 | 15 | .top-row { 16 | background-color: #f7f7f7; 17 | border-bottom: 1px solid #d6d5d5; 18 | justify-content: flex-end; 19 | height: 3.5rem; 20 | display: flex; 21 | align-items: center; 22 | } 23 | 24 | .top-row ::deep a, .top-row .btn-link { 25 | white-space: nowrap; 26 | margin-left: 1.5rem; 27 | } 28 | 29 | .top-row a:first-child { 30 | overflow: hidden; 31 | text-overflow: ellipsis; 32 | } 33 | 34 | @media (max-width: 640.98px) { 35 | .top-row:not(.auth) { 36 | display: none; 37 | } 38 | 39 | .top-row.auth { 40 | justify-content: space-between; 41 | } 42 | 43 | .top-row a, .top-row .btn-link { 44 | margin-left: 0; 45 | } 46 | } 47 | 48 | @media (min-width: 641px) { 49 | .page { 50 | flex-direction: row; 51 | } 52 | 53 | .sidebar { 54 | width: 250px; 55 | height: 100vh; 56 | position: sticky; 57 | top: 0; 58 | } 59 | 60 | .top-row { 61 | position: sticky; 62 | top: 0; 63 | z-index: 1; 64 | } 65 | 66 | .main > div { 67 | padding-left: 2rem !important; 68 | padding-right: 1.5rem !important; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /TrailBlazor/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Home 13 | 14 | 15 | 16 | 17 | Fetch data 18 | 19 | 20 | 21 | 22 | Admin Page 23 | 24 | 25 | 26 | 27 | 28 | @code { 29 | private bool collapseNavMenu = true; 30 | 31 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; 32 | 33 | private void ToggleNavMenu() 34 | { 35 | collapseNavMenu = !collapseNavMenu; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /TrailBlazor/Shared/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /TrailBlazor/TrailBlazor.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | service-worker-assets.js 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /TrailBlazor/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using System 4 | @using System.Timers 5 | @using Microsoft.AspNetCore.Components.Authorization 6 | @using Microsoft.AspNetCore.Components.Forms 7 | @using Microsoft.AspNetCore.Components.Routing 8 | @using Microsoft.AspNetCore.Components.Web 9 | @using Microsoft.AspNetCore.Components.Web.Virtualization 10 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 11 | @using Microsoft.AspNetCore.Authorization 12 | @using Microsoft.JSInterop 13 | @using TrailBlazor 14 | @using TrailBlazor.Shared 15 | @using TrailBlazor.Models 16 | @using TrailBlazor.Services 17 | @using Radzen 18 | @using Radzen.Blazor 19 | -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Local": { 3 | "Authority": "Endpoint here", 4 | "ClientId": "ClientId here", 5 | "PostLogoutRedirectUri": "https://localhost:44318/authentication/logout-callback", 6 | "RedirectUri": "https://localhost:44318/authentication/login-callback", 7 | "ResponseType": "id_token" 8 | } 9 | } -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/css/app.css: -------------------------------------------------------------------------------- 1 | @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); 2 | 3 | html, body { 4 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 5 | } 6 | 7 | a, .btn-link { 8 | color: #0366d6; 9 | } 10 | 11 | .btn-primary { 12 | color: #fff; 13 | background-color: #1b6ec2; 14 | border-color: #1861ac; 15 | } 16 | 17 | .content { 18 | padding-top: 1.1rem; 19 | } 20 | 21 | .valid.modified:not([type=checkbox]) { 22 | outline: 1px solid #26b050; 23 | } 24 | 25 | .invalid { 26 | outline: 1px solid red; 27 | } 28 | 29 | .validation-message { 30 | color: red; 31 | } 32 | 33 | #blazor-error-ui { 34 | background: lightyellow; 35 | bottom: 0; 36 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 37 | display: none; 38 | left: 0; 39 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 40 | position: fixed; 41 | width: 100%; 42 | z-index: 1000; 43 | } 44 | 45 | #blazor-error-ui .dismiss { 46 | cursor: pointer; 47 | position: absolute; 48 | right: 0.75rem; 49 | top: 0.5rem; 50 | } 51 | 52 | .center-element { 53 | display: flex; 54 | flex-direction: column; 55 | align-items: center; 56 | } 57 | 58 | .center-img { 59 | margin-right: auto; 60 | margin-left: auto; 61 | display: block; 62 | } -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/css/open-iconic/FONT-LICENSE: -------------------------------------------------------------------------------- 1 | SIL OPEN FONT LICENSE Version 1.1 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | PREAMBLE 6 | The goals of the Open Font License (OFL) are to stimulate worldwide 7 | development of collaborative font projects, to support the font creation 8 | efforts of academic and linguistic communities, and to provide a free and 9 | open framework in which fonts may be shared and improved in partnership 10 | with others. 11 | 12 | The OFL allows the licensed fonts to be used, studied, modified and 13 | redistributed freely as long as they are not sold by themselves. The 14 | fonts, including any derivative works, can be bundled, embedded, 15 | redistributed and/or sold with any software provided that any reserved 16 | names are not used by derivative works. The fonts and derivatives, 17 | however, cannot be released under any other type of license. The 18 | requirement for fonts to remain under this license does not apply 19 | to any document created using the fonts or their derivatives. 20 | 21 | DEFINITIONS 22 | "Font Software" refers to the set of files released by the Copyright 23 | Holder(s) under this license and clearly marked as such. This may 24 | include source files, build scripts and documentation. 25 | 26 | "Reserved Font Name" refers to any names specified as such after the 27 | copyright statement(s). 28 | 29 | "Original Version" refers to the collection of Font Software components as 30 | distributed by the Copyright Holder(s). 31 | 32 | "Modified Version" refers to any derivative made by adding to, deleting, 33 | or substituting -- in part or in whole -- any of the components of the 34 | Original Version, by changing formats or by porting the Font Software to a 35 | new environment. 36 | 37 | "Author" refers to any designer, engineer, programmer, technical 38 | writer or other person who contributed to the Font Software. 39 | 40 | PERMISSION & CONDITIONS 41 | Permission is hereby granted, free of charge, to any person obtaining 42 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 43 | redistribute, and sell modified and unmodified copies of the Font 44 | Software, subject to the following conditions: 45 | 46 | 1) Neither the Font Software nor any of its individual components, 47 | in Original or Modified Versions, may be sold by itself. 48 | 49 | 2) Original or Modified Versions of the Font Software may be bundled, 50 | redistributed and/or sold with any software, provided that each copy 51 | contains the above copyright notice and this license. These can be 52 | included either as stand-alone text files, human-readable headers or 53 | in the appropriate machine-readable metadata fields within text or 54 | binary files as long as those fields can be easily viewed by the user. 55 | 56 | 3) No Modified Version of the Font Software may use the Reserved Font 57 | Name(s) unless explicit written permission is granted by the corresponding 58 | Copyright Holder. This restriction only applies to the primary font name as 59 | presented to the users. 60 | 61 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 62 | Software shall not be used to promote, endorse or advertise any 63 | Modified Version, except to acknowledge the contribution(s) of the 64 | Copyright Holder(s) and the Author(s) or with their explicit written 65 | permission. 66 | 67 | 5) The Font Software, modified or unmodified, in part or in whole, 68 | must be distributed entirely under this license, and must not be 69 | distributed under any other license. The requirement for fonts to 70 | remain under this license does not apply to any document created 71 | using the Font Software. 72 | 73 | TERMINATION 74 | This license becomes null and void if any of the above conditions are 75 | not met. 76 | 77 | DISCLAIMER 78 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 79 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 80 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 81 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 82 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 83 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 84 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 85 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 86 | OTHER DEALINGS IN THE FONT SOFTWARE. 87 | -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/css/open-iconic/README.md: -------------------------------------------------------------------------------- 1 | [Open Iconic v1.1.1](http://useiconic.com/open) 2 | =========== 3 | 4 | ### Open Iconic is the open source sibling of [Iconic](http://useiconic.com). It is a hyper-legible collection of 223 icons with a tiny footprint—ready to use with Bootstrap and Foundation. [View the collection](http://useiconic.com/open#icons) 5 | 6 | 7 | 8 | ## What's in Open Iconic? 9 | 10 | * 223 icons designed to be legible down to 8 pixels 11 | * Super-light SVG files - 61.8 for the entire set 12 | * SVG sprite—the modern replacement for icon fonts 13 | * Webfont (EOT, OTF, SVG, TTF, WOFF), PNG and WebP formats 14 | * Webfont stylesheets (including versions for Bootstrap and Foundation) in CSS, LESS, SCSS and Stylus formats 15 | * PNG and WebP raster images in 8px, 16px, 24px, 32px, 48px and 64px. 16 | 17 | 18 | ## Getting Started 19 | 20 | #### For code samples and everything else you need to get started with Open Iconic, check out our [Icons](http://useiconic.com/open#icons) and [Reference](http://useiconic.com/open#reference) sections. 21 | 22 | ### General Usage 23 | 24 | #### Using Open Iconic's SVGs 25 | 26 | We like SVGs and we think they're the way to display icons on the web. Since Open Iconic are just basic SVGs, we suggest you display them like you would any other image (don't forget the `alt` attribute). 27 | 28 | ``` 29 | 30 | ``` 31 | 32 | #### Using Open Iconic's SVG Sprite 33 | 34 | Open Iconic also comes in a SVG sprite which allows you to display all the icons in the set with a single request. It's like an icon font, without being a hack. 35 | 36 | Adding an icon from an SVG sprite is a little different than what you're used to, but it's still a piece of cake. *Tip: To make your icons easily style able, we suggest adding a general class to the* `` *tag and a unique class name for each different icon in the* `` *tag.* 37 | 38 | ``` 39 | 40 | 41 | 42 | ``` 43 | 44 | Sizing icons only needs basic CSS. All the icons are in a square format, so just set the `` tag with equal width and height dimensions. 45 | 46 | ``` 47 | .icon { 48 | width: 16px; 49 | height: 16px; 50 | } 51 | ``` 52 | 53 | Coloring icons is even easier. All you need to do is set the `fill` rule on the `` tag. 54 | 55 | ``` 56 | .icon-account-login { 57 | fill: #f00; 58 | } 59 | ``` 60 | 61 | To learn more about SVG Sprites, read [Chris Coyier's guide](http://css-tricks.com/svg-sprites-use-better-icon-fonts/). 62 | 63 | #### Using Open Iconic's Icon Font... 64 | 65 | 66 | ##### …with Bootstrap 67 | 68 | You can find our Bootstrap stylesheets in `font/css/open-iconic-bootstrap.{css, less, scss, styl}` 69 | 70 | 71 | ``` 72 | 73 | ``` 74 | 75 | 76 | ``` 77 | 78 | ``` 79 | 80 | ##### …with Foundation 81 | 82 | You can find our Foundation stylesheets in `font/css/open-iconic-foundation.{css, less, scss, styl}` 83 | 84 | ``` 85 | 86 | ``` 87 | 88 | 89 | ``` 90 | 91 | ``` 92 | 93 | ##### …on its own 94 | 95 | You can find our default stylesheets in `font/css/open-iconic.{css, less, scss, styl}` 96 | 97 | ``` 98 | 99 | ``` 100 | 101 | ``` 102 | 103 | ``` 104 | 105 | 106 | ## License 107 | 108 | ### Icons 109 | 110 | All code (including SVG markup) is under the [MIT License](http://opensource.org/licenses/MIT). 111 | 112 | ### Fonts 113 | 114 | All fonts are under the [SIL Licensed](http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web). 115 | -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css: -------------------------------------------------------------------------------- 1 | @font-face{font-family:Icons;src:url(../fonts/open-iconic.eot);src:url(../fonts/open-iconic.eot?#iconic-sm) format('embedded-opentype'),url(../fonts/open-iconic.woff) format('woff'),url(../fonts/open-iconic.ttf) format('truetype'),url(../fonts/open-iconic.otf) format('opentype'),url(../fonts/open-iconic.svg#iconic-sm) format('svg');font-weight:400;font-style:normal}.oi{position:relative;top:1px;display:inline-block;speak:none;font-family:Icons;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.oi:empty:before{width:1em;text-align:center;box-sizing:content-box}.oi.oi-align-center:before{text-align:center}.oi.oi-align-left:before{text-align:left}.oi.oi-align-right:before{text-align:right}.oi.oi-flip-horizontal:before{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.oi.oi-flip-vertical:before{-webkit-transform:scale(1,-1);-ms-transform:scale(-1,1);transform:scale(1,-1)}.oi.oi-flip-horizontal-vertical:before{-webkit-transform:scale(-1,-1);-ms-transform:scale(-1,1);transform:scale(-1,-1)}.oi-account-login:before{content:'\e000'}.oi-account-logout:before{content:'\e001'}.oi-action-redo:before{content:'\e002'}.oi-action-undo:before{content:'\e003'}.oi-align-center:before{content:'\e004'}.oi-align-left:before{content:'\e005'}.oi-align-right:before{content:'\e006'}.oi-aperture:before{content:'\e007'}.oi-arrow-bottom:before{content:'\e008'}.oi-arrow-circle-bottom:before{content:'\e009'}.oi-arrow-circle-left:before{content:'\e00a'}.oi-arrow-circle-right:before{content:'\e00b'}.oi-arrow-circle-top:before{content:'\e00c'}.oi-arrow-left:before{content:'\e00d'}.oi-arrow-right:before{content:'\e00e'}.oi-arrow-thick-bottom:before{content:'\e00f'}.oi-arrow-thick-left:before{content:'\e010'}.oi-arrow-thick-right:before{content:'\e011'}.oi-arrow-thick-top:before{content:'\e012'}.oi-arrow-top:before{content:'\e013'}.oi-audio-spectrum:before{content:'\e014'}.oi-audio:before{content:'\e015'}.oi-badge:before{content:'\e016'}.oi-ban:before{content:'\e017'}.oi-bar-chart:before{content:'\e018'}.oi-basket:before{content:'\e019'}.oi-battery-empty:before{content:'\e01a'}.oi-battery-full:before{content:'\e01b'}.oi-beaker:before{content:'\e01c'}.oi-bell:before{content:'\e01d'}.oi-bluetooth:before{content:'\e01e'}.oi-bold:before{content:'\e01f'}.oi-bolt:before{content:'\e020'}.oi-book:before{content:'\e021'}.oi-bookmark:before{content:'\e022'}.oi-box:before{content:'\e023'}.oi-briefcase:before{content:'\e024'}.oi-british-pound:before{content:'\e025'}.oi-browser:before{content:'\e026'}.oi-brush:before{content:'\e027'}.oi-bug:before{content:'\e028'}.oi-bullhorn:before{content:'\e029'}.oi-calculator:before{content:'\e02a'}.oi-calendar:before{content:'\e02b'}.oi-camera-slr:before{content:'\e02c'}.oi-caret-bottom:before{content:'\e02d'}.oi-caret-left:before{content:'\e02e'}.oi-caret-right:before{content:'\e02f'}.oi-caret-top:before{content:'\e030'}.oi-cart:before{content:'\e031'}.oi-chat:before{content:'\e032'}.oi-check:before{content:'\e033'}.oi-chevron-bottom:before{content:'\e034'}.oi-chevron-left:before{content:'\e035'}.oi-chevron-right:before{content:'\e036'}.oi-chevron-top:before{content:'\e037'}.oi-circle-check:before{content:'\e038'}.oi-circle-x:before{content:'\e039'}.oi-clipboard:before{content:'\e03a'}.oi-clock:before{content:'\e03b'}.oi-cloud-download:before{content:'\e03c'}.oi-cloud-upload:before{content:'\e03d'}.oi-cloud:before{content:'\e03e'}.oi-cloudy:before{content:'\e03f'}.oi-code:before{content:'\e040'}.oi-cog:before{content:'\e041'}.oi-collapse-down:before{content:'\e042'}.oi-collapse-left:before{content:'\e043'}.oi-collapse-right:before{content:'\e044'}.oi-collapse-up:before{content:'\e045'}.oi-command:before{content:'\e046'}.oi-comment-square:before{content:'\e047'}.oi-compass:before{content:'\e048'}.oi-contrast:before{content:'\e049'}.oi-copywriting:before{content:'\e04a'}.oi-credit-card:before{content:'\e04b'}.oi-crop:before{content:'\e04c'}.oi-dashboard:before{content:'\e04d'}.oi-data-transfer-download:before{content:'\e04e'}.oi-data-transfer-upload:before{content:'\e04f'}.oi-delete:before{content:'\e050'}.oi-dial:before{content:'\e051'}.oi-document:before{content:'\e052'}.oi-dollar:before{content:'\e053'}.oi-double-quote-sans-left:before{content:'\e054'}.oi-double-quote-sans-right:before{content:'\e055'}.oi-double-quote-serif-left:before{content:'\e056'}.oi-double-quote-serif-right:before{content:'\e057'}.oi-droplet:before{content:'\e058'}.oi-eject:before{content:'\e059'}.oi-elevator:before{content:'\e05a'}.oi-ellipses:before{content:'\e05b'}.oi-envelope-closed:before{content:'\e05c'}.oi-envelope-open:before{content:'\e05d'}.oi-euro:before{content:'\e05e'}.oi-excerpt:before{content:'\e05f'}.oi-expand-down:before{content:'\e060'}.oi-expand-left:before{content:'\e061'}.oi-expand-right:before{content:'\e062'}.oi-expand-up:before{content:'\e063'}.oi-external-link:before{content:'\e064'}.oi-eye:before{content:'\e065'}.oi-eyedropper:before{content:'\e066'}.oi-file:before{content:'\e067'}.oi-fire:before{content:'\e068'}.oi-flag:before{content:'\e069'}.oi-flash:before{content:'\e06a'}.oi-folder:before{content:'\e06b'}.oi-fork:before{content:'\e06c'}.oi-fullscreen-enter:before{content:'\e06d'}.oi-fullscreen-exit:before{content:'\e06e'}.oi-globe:before{content:'\e06f'}.oi-graph:before{content:'\e070'}.oi-grid-four-up:before{content:'\e071'}.oi-grid-three-up:before{content:'\e072'}.oi-grid-two-up:before{content:'\e073'}.oi-hard-drive:before{content:'\e074'}.oi-header:before{content:'\e075'}.oi-headphones:before{content:'\e076'}.oi-heart:before{content:'\e077'}.oi-home:before{content:'\e078'}.oi-image:before{content:'\e079'}.oi-inbox:before{content:'\e07a'}.oi-infinity:before{content:'\e07b'}.oi-info:before{content:'\e07c'}.oi-italic:before{content:'\e07d'}.oi-justify-center:before{content:'\e07e'}.oi-justify-left:before{content:'\e07f'}.oi-justify-right:before{content:'\e080'}.oi-key:before{content:'\e081'}.oi-laptop:before{content:'\e082'}.oi-layers:before{content:'\e083'}.oi-lightbulb:before{content:'\e084'}.oi-link-broken:before{content:'\e085'}.oi-link-intact:before{content:'\e086'}.oi-list-rich:before{content:'\e087'}.oi-list:before{content:'\e088'}.oi-location:before{content:'\e089'}.oi-lock-locked:before{content:'\e08a'}.oi-lock-unlocked:before{content:'\e08b'}.oi-loop-circular:before{content:'\e08c'}.oi-loop-square:before{content:'\e08d'}.oi-loop:before{content:'\e08e'}.oi-magnifying-glass:before{content:'\e08f'}.oi-map-marker:before{content:'\e090'}.oi-map:before{content:'\e091'}.oi-media-pause:before{content:'\e092'}.oi-media-play:before{content:'\e093'}.oi-media-record:before{content:'\e094'}.oi-media-skip-backward:before{content:'\e095'}.oi-media-skip-forward:before{content:'\e096'}.oi-media-step-backward:before{content:'\e097'}.oi-media-step-forward:before{content:'\e098'}.oi-media-stop:before{content:'\e099'}.oi-medical-cross:before{content:'\e09a'}.oi-menu:before{content:'\e09b'}.oi-microphone:before{content:'\e09c'}.oi-minus:before{content:'\e09d'}.oi-monitor:before{content:'\e09e'}.oi-moon:before{content:'\e09f'}.oi-move:before{content:'\e0a0'}.oi-musical-note:before{content:'\e0a1'}.oi-paperclip:before{content:'\e0a2'}.oi-pencil:before{content:'\e0a3'}.oi-people:before{content:'\e0a4'}.oi-person:before{content:'\e0a5'}.oi-phone:before{content:'\e0a6'}.oi-pie-chart:before{content:'\e0a7'}.oi-pin:before{content:'\e0a8'}.oi-play-circle:before{content:'\e0a9'}.oi-plus:before{content:'\e0aa'}.oi-power-standby:before{content:'\e0ab'}.oi-print:before{content:'\e0ac'}.oi-project:before{content:'\e0ad'}.oi-pulse:before{content:'\e0ae'}.oi-puzzle-piece:before{content:'\e0af'}.oi-question-mark:before{content:'\e0b0'}.oi-rain:before{content:'\e0b1'}.oi-random:before{content:'\e0b2'}.oi-reload:before{content:'\e0b3'}.oi-resize-both:before{content:'\e0b4'}.oi-resize-height:before{content:'\e0b5'}.oi-resize-width:before{content:'\e0b6'}.oi-rss-alt:before{content:'\e0b7'}.oi-rss:before{content:'\e0b8'}.oi-script:before{content:'\e0b9'}.oi-share-boxed:before{content:'\e0ba'}.oi-share:before{content:'\e0bb'}.oi-shield:before{content:'\e0bc'}.oi-signal:before{content:'\e0bd'}.oi-signpost:before{content:'\e0be'}.oi-sort-ascending:before{content:'\e0bf'}.oi-sort-descending:before{content:'\e0c0'}.oi-spreadsheet:before{content:'\e0c1'}.oi-star:before{content:'\e0c2'}.oi-sun:before{content:'\e0c3'}.oi-tablet:before{content:'\e0c4'}.oi-tag:before{content:'\e0c5'}.oi-tags:before{content:'\e0c6'}.oi-target:before{content:'\e0c7'}.oi-task:before{content:'\e0c8'}.oi-terminal:before{content:'\e0c9'}.oi-text:before{content:'\e0ca'}.oi-thumb-down:before{content:'\e0cb'}.oi-thumb-up:before{content:'\e0cc'}.oi-timer:before{content:'\e0cd'}.oi-transfer:before{content:'\e0ce'}.oi-trash:before{content:'\e0cf'}.oi-underline:before{content:'\e0d0'}.oi-vertical-align-bottom:before{content:'\e0d1'}.oi-vertical-align-center:before{content:'\e0d2'}.oi-vertical-align-top:before{content:'\e0d3'}.oi-video:before{content:'\e0d4'}.oi-volume-high:before{content:'\e0d5'}.oi-volume-low:before{content:'\e0d6'}.oi-volume-off:before{content:'\e0d7'}.oi-warning:before{content:'\e0d8'}.oi-wifi:before{content:'\e0d9'}.oi-wrench:before{content:'\e0da'}.oi-x:before{content:'\e0db'}.oi-yen:before{content:'\e0dc'}.oi-zoom-in:before{content:'\e0dd'}.oi-zoom-out:before{content:'\e0de'} -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cschweig2/TrailBlazor/7b5b39fb887047aab8b03c351b7d43d89185c36f/TrailBlazor/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cschweig2/TrailBlazor/7b5b39fb887047aab8b03c351b7d43d89185c36f/TrailBlazor/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/css/open-iconic/font/fonts/open-iconic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Created by FontForge 20120731 at Tue Jul 1 20:39:22 2014 9 | By P.J. Onori 10 | Created by P.J. Onori with FontForge 2.0 (http://fontforge.sf.net) 11 | 12 | 13 | 14 | 27 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 45 | 47 | 49 | 51 | 53 | 55 | 57 | 59 | 61 | 63 | 65 | 67 | 69 | 71 | 74 | 76 | 79 | 81 | 84 | 86 | 88 | 91 | 93 | 95 | 98 | 100 | 102 | 104 | 106 | 109 | 112 | 115 | 117 | 121 | 123 | 125 | 127 | 130 | 132 | 134 | 136 | 138 | 141 | 143 | 145 | 147 | 149 | 151 | 153 | 155 | 157 | 159 | 162 | 165 | 167 | 169 | 172 | 174 | 177 | 179 | 181 | 183 | 185 | 189 | 191 | 194 | 196 | 198 | 200 | 202 | 205 | 207 | 209 | 211 | 213 | 215 | 218 | 220 | 222 | 224 | 226 | 228 | 230 | 232 | 234 | 236 | 238 | 241 | 243 | 245 | 247 | 249 | 251 | 253 | 256 | 259 | 261 | 263 | 265 | 267 | 269 | 272 | 274 | 276 | 280 | 282 | 285 | 287 | 289 | 292 | 295 | 298 | 300 | 302 | 304 | 306 | 309 | 312 | 314 | 316 | 318 | 320 | 322 | 324 | 326 | 330 | 334 | 338 | 340 | 343 | 345 | 347 | 349 | 351 | 353 | 355 | 358 | 360 | 363 | 365 | 367 | 369 | 371 | 373 | 375 | 377 | 379 | 381 | 383 | 386 | 388 | 390 | 392 | 394 | 396 | 399 | 401 | 404 | 406 | 408 | 410 | 412 | 414 | 416 | 419 | 421 | 423 | 425 | 428 | 431 | 435 | 438 | 440 | 442 | 444 | 446 | 448 | 451 | 453 | 455 | 457 | 460 | 462 | 464 | 466 | 468 | 471 | 473 | 477 | 479 | 481 | 483 | 486 | 488 | 490 | 492 | 494 | 496 | 499 | 501 | 504 | 506 | 509 | 512 | 515 | 517 | 520 | 522 | 524 | 526 | 529 | 532 | 534 | 536 | 539 | 542 | 543 | 544 | -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cschweig2/TrailBlazor/7b5b39fb887047aab8b03c351b7d43d89185c36f/TrailBlazor/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cschweig2/TrailBlazor/7b5b39fb887047aab8b03c351b7d43d89185c36f/TrailBlazor/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cschweig2/TrailBlazor/7b5b39fb887047aab8b03c351b7d43d89185c36f/TrailBlazor/wwwroot/favicon.ico -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cschweig2/TrailBlazor/7b5b39fb887047aab8b03c351b7d43d89185c36f/TrailBlazor/wwwroot/icon-512.png -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cschweig2/TrailBlazor/7b5b39fb887047aab8b03c351b7d43d89185c36f/TrailBlazor/wwwroot/img/logo.png -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Netrush Login 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Loading... 19 | 20 | 21 | An unhandled error has occurred. 22 | Reload 23 | 🗙 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/js/alert.js: -------------------------------------------------------------------------------- 1 | function JSAlert() { 2 | alert("Greetings, your excellency") 3 | } -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/js/firebaseFunctions.js: -------------------------------------------------------------------------------- 1 | async function firebaseCreateUser(email, password) { 2 | try { 3 | await firebase.auth().createUserWithEmailAndPassword(email, password); 4 | await firebaseEmailSignIn(email, password); 5 | } catch (error) { 6 | var errorResult = error.code + ": " + error.message; 7 | return errorResult; 8 | }; 9 | } 10 | 11 | async function firebaseEmailSignIn(email, password) { 12 | try { 13 | await firebase.auth().signInWithEmailAndPassword(email, password) 14 | } catch (error) { 15 | var errorResult = error.code + ": " + error.message; 16 | return errorResult; 17 | } 18 | } 19 | 20 | async function firebaseGetCurrentUser() { 21 | var user = await firebase.auth().currentUser; 22 | if (user) { 23 | const JsonUser = JSON.stringify(user); 24 | return JsonUser; 25 | } else { 26 | return null; 27 | } 28 | } 29 | 30 | async function firebaseSignOut() { 31 | try { 32 | await firebase.auth().signOut(); 33 | return false; 34 | } catch (error) { 35 | return true; 36 | } 37 | } 38 | 39 | async function initializeInactivityTimer(dotnetHelper) { 40 | var timer; 41 | let counter = 0; 42 | document.addEventListener("mousemove", resetTimer); 43 | document.addEventListener("keypress", resetTimer); 44 | function resetTimer() { 45 | if (counter == 0) { 46 | clearTimeout(timer); 47 | timer = setTimeout(logout, 20000); 48 | } 49 | } 50 | function logout() { 51 | dotnetHelper.invokeMethodAsync("LogoutClick"); 52 | counter++; 53 | } 54 | } 55 | 56 | async function getRefreshToken(refreshToken) { 57 | var myHeaders = new Headers(); 58 | myHeaders.append("Content-Type", "application/json"); 59 | var raw = JSON.stringify({ 60 | "grant_type": "refresh_token", 61 | "refresh_token": refreshToken 62 | }); 63 | var requestOptions = { 64 | method: 'POST', 65 | headers: myHeaders, 66 | body: raw, 67 | redirect: 'follow' 68 | }; 69 | const response = await fetch("https://securetoken.googleapis.com/v1/token?key=[API_KEY]", requestOptions) 70 | const responseText = await response.json(); 71 | return JSON.stringify(responseText); 72 | } -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TrailBlazor", 3 | "short_name": "TrailBlazor", 4 | "start_url": "./", 5 | "display": "standalone", 6 | "background_color": "#ffffff", 7 | "theme_color": "#03173d", 8 | "icons": [ 9 | { 10 | "src": "icon-512.png", 11 | "type": "image/png", 12 | "sizes": "512x512" 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/sample-data/weather.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "date": "2018-05-06", 4 | "temperatureC": 1, 5 | "summary": "Freezing" 6 | }, 7 | { 8 | "date": "2018-05-07", 9 | "temperatureC": 14, 10 | "summary": "Bracing" 11 | }, 12 | { 13 | "date": "2018-05-08", 14 | "temperatureC": -13, 15 | "summary": "Freezing" 16 | }, 17 | { 18 | "date": "2018-05-09", 19 | "temperatureC": -16, 20 | "summary": "Balmy" 21 | }, 22 | { 23 | "date": "2018-05-10", 24 | "temperatureC": -2, 25 | "summary": "Chilly" 26 | } 27 | ] 28 | -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/service-worker.js: -------------------------------------------------------------------------------- 1 | // In development, always fetch from the network and do not enable offline support. 2 | // This is because caching would make development more difficult (changes would not 3 | // be reflected on the first load after each change). 4 | self.addEventListener('fetch', () => { }); 5 | -------------------------------------------------------------------------------- /TrailBlazor/wwwroot/service-worker.published.js: -------------------------------------------------------------------------------- 1 | // Caution! Be sure you understand the caveats before publishing an application with 2 | // offline support. See https://aka.ms/blazor-offline-considerations 3 | 4 | self.importScripts('./service-worker-assets.js'); 5 | self.addEventListener('install', event => event.waitUntil(onInstall(event))); 6 | self.addEventListener('activate', event => event.waitUntil(onActivate(event))); 7 | self.addEventListener('fetch', event => event.respondWith(onFetch(event))); 8 | 9 | const cacheNamePrefix = 'offline-cache-'; 10 | const cacheName = `${cacheNamePrefix}${self.assetsManifest.version}`; 11 | const offlineAssetsInclude = [ /\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/, /\.blat$/, /\.dat$/ ]; 12 | const offlineAssetsExclude = [ /^service-worker\.js$/ ]; 13 | 14 | async function onInstall(event) { 15 | console.info('Service worker: Install'); 16 | 17 | // Fetch and cache all matching items from the assets manifest 18 | const assetsRequests = self.assetsManifest.assets 19 | .filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url))) 20 | .filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url))) 21 | .map(asset => new Request(asset.url, { integrity: asset.hash })); 22 | await caches.open(cacheName).then(cache => cache.addAll(assetsRequests)); 23 | } 24 | 25 | async function onActivate(event) { 26 | console.info('Service worker: Activate'); 27 | 28 | // Delete unused caches 29 | const cacheKeys = await caches.keys(); 30 | await Promise.all(cacheKeys 31 | .filter(key => key.startsWith(cacheNamePrefix) && key !== cacheName) 32 | .map(key => caches.delete(key))); 33 | } 34 | 35 | async function onFetch(event) { 36 | let cachedResponse = null; 37 | if (event.request.method === 'GET') { 38 | // For all navigation requests, try to serve index.html from cache 39 | // If you need some URLs to be server-rendered, edit the following check to exclude those URLs 40 | const shouldServeIndexHtml = event.request.mode === 'navigate'; 41 | 42 | const request = shouldServeIndexHtml ? 'index.html' : event.request; 43 | const cache = await caches.open(cacheName); 44 | cachedResponse = await cache.match(request); 45 | } 46 | 47 | return cachedResponse || fetch(event.request); 48 | } 49 | --------------------------------------------------------------------------------
Sorry, there's nothing at this address.
This component demonstrates fetching data from the server.
Loading...
Welcome to the TrailBlazor authentication demo for Blazor