An open API service indexing awesome lists of open source software.

https://github.com/Adddedtiya/BlazorCookieAuthentication

Blazor Cookie based authentication and authorization template
https://github.com/Adddedtiya/BlazorCookieAuthentication

blazor blazor-server blazor-template csharp dotnet

Last synced: 5 months ago
JSON representation

Blazor Cookie based authentication and authorization template

Awesome Lists containing this project

README

          

# Blazor Server Cookie Authentication
Mostly ready to use Cookie session Based Authorization. (Updated to use the new .net8 template, configued to Blazor Server)

## How To use

Clone this reposity (or download the zip), on the repository (or the extracted zip)
```
dotnet new install ./
```

This will create a new Template in dotnet called `Blazor Server Cookie Based Auth` or `blazorcookie` for short
```
Template Name Short Name Language Tags
-------------------------------------------- -------------------------- ---------- ------------------------------
Blazor Server App blazorserver [C#] Web/Blazor
Blazor Server Cookie Based Auth blazorcookie [C#] Web/Blazor/Blazor Server <-- HERE
Blazor Web App blazor [C#] Web/Blazor/WebAssembly
Blazor WebAssembly Standalone App blazorwasm [C#] Web/Blazor/WebAssembly/PWA
```

With this you can create a new project based on this template such as
```
dotnet new blazorcookie -o MyProjectName
```
with "MyProjectName" beeing the name of your new project, based on this Template

## What included

A mostly included bell and whistles such as roles, authorizations, basic password hashing and verification and such, with examples on it are spread around this template allowing for easy use and adaptation.

Examples / Parts / Whistles included are :

- JS Interop for Cookies Read, Write, and Delete
- Basic Password Hashing and Verification
- AuthenticationStateProvider overloading
- Easy to extend UserData class template
- Basic database interface to implement
- dotnet roles and claims authorizations

In the included demo "FakeDatabase" there are 2 in users with the following credentials

|ID |Username| Password | Role |
|-- |-- |-- | -- |
| 1 | Admin | Password1 | Administrator |
| 2 | User1 | Password1 | Standard |

The ready to use template are available on release tab and can be use directly on dotnet templates, also we welcome any pull requests.

## Credits
This Template is based on multiple Blazor Auth Example online, with the following names examples help me to further understand how to implement this
- [Kazi Mushfiqur Rahman](https://github.com/mushfiq1998/BlazorServerAuthenticationAndAuthorization/)