Skip to content

Commit

Permalink
Merge pull request #5 from Aguafrommars/user/ole
Browse files Browse the repository at this point in the history
User/ole
  • Loading branch information
aguacongas authored Jan 8, 2023
2 parents ff8b386 + 41fa43b commit 66b7f75
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ Simplify OIDC authentication for MAUI Blazor app

[![Build status](https://ci.appveyor.com/api/projects/status/sfbc266vmv95kf3l/branch/main?svg=true)](https://ci.appveyor.com/project/aguacongas/maui-blazor-authentication/branch/main)

## Use
Nuget packages
--------------
|Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc|
|:------:|
|[![][Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc-badge]][Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc-nuget]|
|[![][Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc-downloadbadge]][Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc-nuget]|

[Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc-badge]: https://img.shields.io/nuget/v/Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc.svg
[Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc-downloadbadge]: https://img.shields.io/nuget/dt/Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc.svg
[Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc-nuget]: https://www.nuget.org/packages/Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc/

## Setup

Read [`Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc` *Readme.md*](src/Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc/README.md) for information to use the library.

Expand Down
25 changes: 25 additions & 0 deletions samples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc sample

This sample demonstrates how we can share blazor code between a [Blazor WebAssembly](https://learn.microsoft.com/en-us/aspnet/core/blazor/?view=aspnetcore-7.0#blazor-webassembly) application and a [MAUI Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/hybrid/tutorials/maui?view=aspnetcore-7.0&pivots=windows) application, and use [Blazor authentication and authorization](https://learn.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-7.0) with **Aguacongas.AspNetCore.Components.Maui.Authentication.Oidc**.

It contains:

``` bash
├─ Maui.Blazor.Client: a MAUI Blazor project
├─ Server: an OIDC server project containing the WeatherForecast API
├─ Shared: a class library project containing the model shared by the server and clients
├─ Shared.Blazor.UI: a Razor components project containing pages and components shared by Blazor WASM and MAUI Blazor
└── Web.Blazor.Client: a Blazor WASM project
```

The application is the default Blazor application generated with `dotnet new` template.

You need to be logged to access to weather forecast, the *FetchData.razor* page is decorated with:

```cs
@attribute [Authorize]
```

You can login with *alice* (pwd: alice) or *bob* (pwd: bob).

The OIDC server is a [Duende IdentityServer](https://duendesoftware.com/products/identityserver) built from `dotnet new` template.
1 change: 1 addition & 0 deletions samples/Server/Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<CodeAnalysisRuleSet>..\..\.sonarlint\aguafrommars_maui.blazor.authenticationcsharp.ruleset</CodeAnalysisRuleSet>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions samples/Shared/Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<CodeAnalysisRuleSet>..\..\.sonarlint\aguafrommars_maui.blazor.authenticationcsharp.ruleset</CodeAnalysisRuleSet>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions samples/UI/Shared.Blazor.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<CodeAnalysisRuleSet>..\..\.sonarlint\aguafrommars_maui.blazor.authenticationcsharp.ruleset</CodeAnalysisRuleSet>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions samples/Web/Web.Blazor.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<CodeAnalysisRuleSet>..\..\.sonarlint\aguafrommars_maui.blazor.authenticationcsharp.ruleset</CodeAnalysisRuleSet>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 66b7f75

Please sign in to comment.