Skip to content

Commit edfcb21

Browse files
authored
Sample Improvement (Part 1/2) (#20)
* Sample Improvement * Added UAuthStateView Component * Add UAuthScope component and UAuthReactiveComponentBase & Arrange Other Components * Enhanced Login Page * Fixed Login Failure Message Flow * Enhanced Login Lockout Client Handling * Complete Login Flow For Client & Login Sample Page * Fix Test * Login Page Last Improvement * Login Page Cleanup * Home Page Profile Section Design & Fixed DisplayName Doesn't Show in State & Sample DarkMode Implementation * Diagnostics Section Design & RefreshOutcome Improvement * Improve Validation Client Handling & Postpone Reauth Flow Until Adding MFA * Enhance Identifier Handling (Part 1) * Enhance Credential Plugin Domain
1 parent 211574f commit edfcb21

File tree

205 files changed

+3655
-1724
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+3655
-1724
lines changed

samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="9.0.0-rc.1" />
13-
<PackageReference Include="MudBlazor" Version="9.0.0-rc.1" />
12+
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="9.0.1" />
13+
<PackageReference Include="MudBlazor" Version="9.0.0" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/Components/Layout/MainLayout.razor

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
@using CodeBeam.UltimateAuth.Server.Infrastructure
33
@inherits LayoutComponentBase
44

5-
<UAuthClientProvider />
6-
<MudThemeProvider />
7-
<MudPopoverProvider />
8-
<MudDialogProvider />
9-
<MudSnackbarProvider />
10-
115
@Body
126

137
<div id="blazor-error-ui" data-nosnippet>

samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/Components/Pages/Home.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@using CodeBeam.UltimateAuth.Client
44
@using CodeBeam.UltimateAuth.Client.Authentication
55
@using CodeBeam.UltimateAuth.Client.Diagnostics
6-
@using CodeBeam.UltimateAuth.Client.Utilities
6+
@using CodeBeam.UltimateAuth.Client.Infrastructure
77
@using CodeBeam.UltimateAuth.Core.Abstractions
88
@using CodeBeam.UltimateAuth.Core.Contracts
99
@using CodeBeam.UltimateAuth.Core.Domain
@@ -17,7 +17,7 @@
1717
@inject IHubCredentialResolver HubCredentialResolver
1818
@inject IAuthStore AuthStore
1919
@inject IBrowserStorage BrowserStorage
20-
@inject IUAuthFlowService<UserKey> Flow
20+
@inject IUAuthFlowService Flow
2121
@inject ISnackbar Snackbar
2222
@inject IFlowCredentialResolver CredentialResolver
2323
@inject IUAuthClient UAuthClient

samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/Components/Pages/Home.razor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using CodeBeam.UltimateAuth.Client.Contracts;
2-
using CodeBeam.UltimateAuth.Client.Utilities;
32
using CodeBeam.UltimateAuth.Core.Contracts;
43
using CodeBeam.UltimateAuth.Core.Domain;
54
using CodeBeam.UltimateAuth.Server.Stores;

samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/Components/Routes.razor

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<UAuthApp>
2+
3+
<MudThemeProvider />
4+
<MudPopoverProvider />
5+
<MudDialogProvider />
6+
<MudSnackbarProvider />
7+
28
<Router AppAssembly="typeof(Program).Assembly" NotFoundPage="typeof(Pages.NotFound)">
39
<Found Context="routeData">
410
<AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />

samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/Program.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@
3030
builder.Services.AddMudServices();
3131
builder.Services.AddMudExtensions();
3232

33-
builder.Services
34-
.AddAuthentication(options =>
35-
{
36-
options.DefaultAuthenticateScheme = UAuthSchemeDefaults.AuthenticationScheme;
37-
options.DefaultSignInScheme = UAuthSchemeDefaults.AuthenticationScheme;
38-
options.DefaultChallengeScheme = UAuthSchemeDefaults.AuthenticationScheme;
39-
})
40-
.AddUAuthCookies();
33+
//builder.Services
34+
// .AddAuthentication(options =>
35+
// {
36+
// options.DefaultAuthenticateScheme = UAuthSchemeDefaults.AuthenticationScheme;
37+
// options.DefaultSignInScheme = UAuthSchemeDefaults.AuthenticationScheme;
38+
// options.DefaultChallengeScheme = UAuthSchemeDefaults.AuthenticationScheme;
39+
// })
40+
// .AddUAuthCookies();
4141

42-
builder.Services.AddAuthorization();
42+
//builder.Services.AddAuthorization();
4343

44-
builder.Services.AddHttpContextAccessor();
44+
//builder.Services.AddHttpContextAccessor();
4545

4646
builder.Services.AddUltimateAuthServer(o => {
47-
o.Diagnostics.EnableRefreshHeaders = true;
47+
o.Diagnostics.EnableRefreshDetails = true;
4848
//o.Session.MaxLifetime = TimeSpan.FromSeconds(32);
4949
//o.Session.TouchInterval = TimeSpan.FromSeconds(9);
5050
//o.Session.IdleTimeout = TimeSpan.FromSeconds(15);
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@namespace CodeBeam.UltimateAuth.Sample
2+
@inherits ComponentBase
3+
4+
<svg xmlns="http://www.w3.org/2000/svg"
5+
viewBox="0 0 200 240"
6+
width="@Size"
7+
height="@Size"
8+
style="@BuildStyle()"
9+
class="@Class">
10+
11+
@if (Variant == UAuthLogoVariant.Brand)
12+
{
13+
<path fill="@ShieldColor"
14+
d="M32.39,14.07H167.61c11.27,0,18,6.76,18,18V133.52
15+
c0,22.54-58.59,69.87-85.64,92.41
16+
-27-22.54-85.64-69.87-85.64-92.41V32.1
17+
C14.36,20.83,21.12,14.07,32.39,14.07Z" />
18+
19+
<path fill="@KeyColor"
20+
fill-rule="evenodd"
21+
d="@KeyPath" />
22+
}
23+
else
24+
{
25+
<path d="M32.39,14.07H167.61c11.27,0,18,6.76,18,18V133.52
26+
c0,22.54-58.59,69.87-85.64,92.41
27+
-27-22.54-85.64-69.87-85.64-92.41V32.1
28+
C14.36,20.83,21.12,14.07,32.39,14.07Z" />
29+
30+
<path fill-rule="evenodd"
31+
d="@KeyPath" />
32+
}
33+
</svg>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using Microsoft.AspNetCore.Components;
2+
using Microsoft.AspNetCore.Components.Web;
3+
4+
namespace CodeBeam.UltimateAuth.Sample;
5+
6+
public partial class UAuthLogo : ComponentBase
7+
{
8+
[Parameter] public UAuthLogoVariant Variant { get; set; } = UAuthLogoVariant.Brand;
9+
10+
[Parameter] public int Size { get; set; } = 32;
11+
12+
[Parameter] public string? ShieldColor { get; set; } = "#00072d";
13+
[Parameter] public string? KeyColor { get; set; } = "#f6f5ae";
14+
15+
[Parameter] public string? Class { get; set; }
16+
[Parameter] public string? Style { get; set; }
17+
18+
private string BuildStyle()
19+
{
20+
if (Variant == UAuthLogoVariant.Mono)
21+
return $"color: {KeyColor}; {Style}";
22+
23+
return Style ?? "";
24+
}
25+
26+
protected string KeyPath => @"
27+
M120.43,39.44H79.57A11.67,11.67,0,0,0,67.9,51.11V77.37
28+
A11.67,11.67,0,0,0,79.57,89H90.51l3.89,3.9v5.32l-3.8,3.81v81.41H99
29+
v-5.33h13.69V169H108.1v-3.8H99C99,150.76,111.9,153,111.9,153
30+
V99.79h-8V93.32L108.19,89h12.24
31+
A11.67,11.67,0,0,0,132.1,77.37V51.11
32+
A11.67,11.67,0,0,0,120.43,39.44Z
33+
34+
M79.57,48.19h5.84a2.92,2.92 0 0 1 2.92,2.92
35+
v5.84a2.92,2.92 0 0 1 -2.92,2.92
36+
h-5.84a2.91,2.91 0 0 1 -2.91,-2.92
37+
v-5.84a2.91,2.91 0 0 1 2.91,-2.92Z
38+
39+
M79.57,68.62h5.84a2.92,2.92 0 0 1 2.92,2.92
40+
v5.83a2.92,2.92 0 0 1 -2.92,2.92
41+
h-5.84a2.91,2.91 0 0 1 -2.91,-2.92
42+
v-5.83a2.91,2.91 0 0 1 2.91,-2.92Z
43+
44+
M114.59,48.19h5.84a2.92,2.92 0 0 1 2.91,2.92
45+
v5.84a2.91,2.91 0 0 1 -2.91,2.91
46+
h-5.84a2.92,2.92 0 0 1 -2.92,-2.91
47+
v-5.84a2.92,2.92 0 0 1 2.92,-2.92Z
48+
49+
M114.59,68.62h5.84a2.92,2.92 0 0 1 2.91,2.92
50+
v5.83a2.91,2.91 0 0 1 -2.91,2.92
51+
h-5.84a2.92,2.92 0 0 1 -2.92,-2.92
52+
v-5.83a2.92,2.92 0 0 1 2.92,-2.92Z
53+
";
54+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace CodeBeam.UltimateAuth.Sample;
2+
3+
public enum UAuthLogoVariant
4+
{
5+
Brand,
6+
Mono
7+
}

samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/CodeBeam.UltimateAuth.Sample.BlazorServer.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.1" />
12-
<PackageReference Include="MudBlazor" Version="9.0.0-rc.1" />
13-
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="9.0.0-rc.1" />
14-
<PackageReference Include="Scalar.AspNetCore" Version="2.12.18" />
12+
<PackageReference Include="MudBlazor" Version="9.0.0" />
13+
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="9.0.1" />
14+
<PackageReference Include="Scalar.AspNetCore" Version="2.12.46" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

0 commit comments

Comments
 (0)