{"id":13465872,"url":"https://github.com/christiansparre/BlazorAuthenticationSample","last_synced_at":"2025-03-25T21:30:36.918Z","repository":{"id":150433876,"uuid":"207366559","full_name":"christiansparre/BlazorAuthenticationSample","owner":"christiansparre","description":"A sample showing some of the ASP.NET Core Blazor authentication features (also some testing...) 🚀","archived":true,"fork":false,"pushed_at":"2020-06-20T11:17:56.000Z","size":125,"stargazers_count":85,"open_issues_count":0,"forks_count":12,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-07-31T15:02:00.572Z","etag":null,"topics":["aspnetcore","authentication","blazor","dotnetcore"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/christiansparre.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-09-09T17:33:36.000Z","updated_at":"2024-03-28T12:13:25.000Z","dependencies_parsed_at":"2023-05-18T01:30:50.562Z","dependency_job_id":null,"html_url":"https://github.com/christiansparre/BlazorAuthenticationSample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christiansparre%2FBlazorAuthenticationSample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christiansparre%2FBlazorAuthenticationSample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christiansparre%2FBlazorAuthenticationSample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christiansparre%2FBlazorAuthenticationSample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christiansparre","download_url":"https://codeload.github.com/christiansparre/BlazorAuthenticationSample/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222091639,"owners_count":16929668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aspnetcore","authentication","blazor","dotnetcore"],"created_at":"2024-07-31T15:00:36.452Z","updated_at":"2024-10-29T18:30:15.516Z","avatar_url":"https://github.com/christiansparre.png","language":"C#","funding_links":[],"categories":["Sample Projects"],"sub_categories":["Authentication"],"readme":"*Not really maintaining this anymore, see https://docs.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-3.1 for the official ASP.NET Core Blazor authentication and authorization. It's quite comprehensive*\n\n# ASP.NET Core Blazor (Server side) Authentication Sample\nThis sample shows some more \"complex\" and \"real world\" scenarios for handling `Authentication` and `Authorization` with ASP.NET Core server side Blazor.\n\nThe idea was to organize the sample a bit more like a real app, and just go a tiny step further than the built in template that comes in the box.\n\nIt's a work in progress... 🤷‍♂️\n\n## Structure\nThe app is comprised of few \"parts\". The `App` part and the `Account` part, plus a few other things. \n\n### Account part\n\nThe `Account` part contains pages to register and and sign in etc. \n\nA little note is the `SignIn` page where there is a little extra hacky step as you cannot set cookies from Blazor easily. See for yourself 🤣\n\n### App part\n\nIn the `App` you need to be authenticated. This was done by adding `@attribute [Authorize]` to `_Imports.razor` in the `App/Pages` so all pages in that folder require authorization.\n\nThere is also a `Sidebar` menu that uses an `AuthorizeView` to trigger and \"administrator\" section of the menu based on roles.\n\n## Data\nWhen started the app sets up some test users, see `Startup.cs` for those.\n\n# Unit tests\nThere is a few tests of some of the custom components as I also wanted to explore Unit Testing of Blazor Components.\n\nThe tests are using a slightly modified version of Steve Sanderson's [BlazorUnitTestingPrototype](https://github.com/SteveSandersonMS/BlazorUnitTestingPrototype). See [my fork here](https://github.com/christiansparre/BlazorUnitTestingPrototype/tree/feature/testhost). Also see Steve's [blog post](http://blog.stevensanderson.com/2019/08/29/blazor-unit-testing-prototype/) about the testing prototype.\n \n# Ideas\n\n- Would like to see if one could make a component to \"generalize\" some of the code around [Resource-based authorization](https://docs.microsoft.com/en-us/aspnet/core/security/authorization/resourcebased)\n- Explore some more testing, I think Steve's prototype is a nice foundation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristiansparre%2FBlazorAuthenticationSample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristiansparre%2FBlazorAuthenticationSample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristiansparre%2FBlazorAuthenticationSample/lists"}