Skip to content

Commit a5e838e

Browse files
authored
Add EFCore Sample (#27)
* Added Some Client Tests * Created Blacor Server EFCore Sample * Session Store Fix * Added Facade UAuthDbContext * Fix CORS & Completed Samples * Update README
1 parent 665ca4a commit a5e838e

File tree

163 files changed

+8857
-1084
lines changed

Some content is hidden

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

163 files changed

+8857
-1084
lines changed

README.md

Lines changed: 130 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,118 @@ The first preview release (**v 0.1.0-preview**) is planned within the next week.
1616
[![Discord](https://img.shields.io/discord/1459498792192839774?color=%237289da&label=Discord&logo=discord&logoColor=%237289da&style=flat-square)](https://discord.gg/QscA86dXSR)
1717
[![codecov](https://codecov.io/gh/CodeBeamOrg/UltimateAuth/branch/dev/graph/badge.svg)](https://codecov.io/gh/CodeBeamOrg/UltimateAuth)
1818

19+
---
20+
21+
## 📑 Table of Contents
22+
23+
- [🗺 Roadmap](#-roadmap)
24+
- [🌟 Why UltimateAuth](#-why-ultimateauth)
25+
- [🚀 Quick Start](#-quick-start)
26+
- [💡 Usage](#-usage)
27+
- [📘 Documentation](#-documentation)
28+
- [🤝 Contributing](#-contributing)
29+
- [⭐ Acknowledgements](#-acknowledgements)
1930

2031
---
2132

22-
UltimateAuth is an open-source authentication framework that unifies secure session and token based authentication, modern PKCE flows, Blazor/Maui-ready client experiences, and a fully extensible architecture — all with a focus on clarity, lightweight design, and developer happiness.
33+
UltimateAuth is an open-source auth framework with platform-level capabilities that unifies secure session, cookie and token based Auth, modern PKCE flows, Blazor/Maui-ready client experiences - eliminating the complexity of traditional Auth systems while providing a clean, lightweight, extensible and developer-first architecture.
34+
35+
---
36+
## 🗺 Roadmap
37+
38+
| Phase | Version | Scope | Status | Release Date |
39+
| ----------------------- | ------------- | ----------------------------------------- | -------------- | ------------ |
40+
| First Preview | 0.1.0-preview | "Stable" Preview Core | ✅ Completed | Last check |
41+
| First Release* | 0.1.0 | Fully Documented & Quality Tested | 🟡 In Progress | Q2 2026 |
42+
| Product Expansion | 0.2.0 | Full Auth Modes | 🟡 In Progress | Q2 2026 |
43+
| Security Expansion | 0.3.0 | MFA, Reauth, Rate Limiting | 🔜 Planned | Q2 2026 |
44+
| Infrastructure Expansion| 0.4.0 | Redis, Distributed Cache, Password Hasher | 🔜 Planned | Q2 2026 |
45+
| Multi-Tenant Expansion | 0.5.0 | Multi tenant management | 🔜 Planned | Q3 2026 |
46+
| Extensibility Expansion | 0.6.0 | Audit, events, hooks | 🔜 Planned | Q3 2026 |
47+
| Performance Expansion | 0.7.0 | Benchmarks, caching | 🔜 Planned | Q3 2026 |
48+
| Ecosystem Expansion | 0.8.0 | Migration tools | 🔜 Planned | Q4 2026 |
49+
| v1.0 | 1.0.0 | Locked API, align with .NET 11 | 🔜 Planned | Q4 2026 |
50+
51+
*v 0.1.0 already provides a skeleton of multi tenancy, MFA, reauth etc. Expansion releases will enhance these areas.
52+
53+
> The project roadmap is actively maintained as a GitHub issue:
54+
55+
👉 https://github.com/CodeBeamOrg/UltimateAuth/issues/8
56+
57+
We keep it up-to-date with current priorities, planned features, and progress. Feel free to follow, comment, or contribute ideas.
58+
59+
<details>
60+
61+
> UltimateAuth is currently in the final stage of the first preview release (v 0.1.0-preview).
62+
63+
> Core architecture is complete and validated through working samples.
64+
65+
> Ongoing work:
66+
> - Final API surface review
67+
> - Developer experience improvements
68+
> - EF Core integration polishing
69+
> - Documentation refinement
70+
</details>
2371
2472
---
2573

2674
## 🌟 Why UltimateAuth: The Six-Point Principles
2775

28-
### **1) Developer-Centric & User-Friendly**
29-
Clean APIs, predictable behavior, minimal ceremony — designed to make authentication *pleasant* for developers.
76+
### 1) Unified Authentication System
77+
78+
One solution, one mental model — across Blazor Server, WASM, MAUI, and APIs.
79+
UltimateAuth eliminates fragmentation by handling client differences internally and exposing a single, consistent API.
3080

31-
### **2) Security-Driven**
32-
PKCE, hardened session flows, reuse detection, event-driven safeguards, device awareness, and modern best practices.
81+
### 2) Plug & Play Ready
3382

34-
### **3) Extensible & Lightweight by Design**
35-
Every component can be replaced or overridden.
36-
No forced dependencies. No unnecessary weight.
83+
Built-in capabilities designed for real-world scenarios:
3784

38-
### **4) Plug-and-Play Ready**
39-
From setup to production, UltimateAuth prioritizes a frictionless integration journey with sensible defaults.
85+
- Automatic client profile detection (blazor server - WASM - MAUI)
86+
- Selectable authentication modes (Session / Token / Hybrid / SemiHybrid)
87+
- Device-aware sessions
88+
- PKCE flows out of the box
89+
- Unified session + token lifecycle
90+
- Event-driven extensibility
4091

41-
### **5) Blazor & MAUI-Ready for Modern .NET**
42-
Blazor WebApp, Blazor WASM, Blazor Server, and .NET MAUI expose weaknesses in traditional auth systems.
43-
UltimateAuth is engineered from day one to support real-world scenarios across the entire modern .NET UI stack.
92+
No boilerplate. No hidden complexity.
4493

45-
### **6) Unified Framework**
46-
One solution, same codebase across Blazor server, WASM and MAUI. UltimateAuth handles client differences internally and providing consistent and reliable public API.
94+
### 3) Developer-Centric
95+
96+
Clean APIs, predictable behavior, minimal ceremony — designed to make authentication pleasant.
97+
98+
### 4) Security as a First-Class Concern
99+
100+
Modern security built-in by default:
101+
102+
- PKCE support
103+
- Session reuse detection
104+
- Device tracking
105+
- Hardened auth flows
106+
- Safe defaults with extensibility
107+
108+
### 5) Extensible & Lightweight
109+
110+
Start simple, scale infinitely:
111+
112+
- Works out of the box with sensible defaults
113+
- Replace any component when needed
114+
- No forced architecture decisions
115+
116+
### 6) Built for Modern .NET Applications
117+
118+
Designed specifically for real-world .NET environments:
119+
120+
- Blazor Server
121+
- Blazor WASM
122+
- .NET MAUI
123+
- Backend APIs
124+
125+
Traditional auth solutions struggle here — UltimateAuth embraces it.
47126

48127
---
49128

50129
# 🚀 Quick Start
130+
> ⏱ Takes ~2 minutes to get started
51131
52132
### 1) Install packages (Will be available soon)
53133

@@ -66,7 +146,11 @@ Server registration:
66146
```csharp
67147
builder.Services
68148
.AddUltimateAuthServer()
69-
.AddUltimateAuthEntityFrameworkCore(); // Production
149+
.AddUltimateAuthEntityFrameworkCore(db =>
150+
{
151+
// use with your database provider
152+
db.UseSqlite("Data Source=uauth.db");
153+
});
70154

71155
// OR
72156
@@ -107,7 +191,36 @@ Place this in `App.razor` or `index.html`
107191
<script src="_content/CodeBeam.UltimateAuth.Client.Blazor/uauth.min.js"></script>
108192
```
109193

110-
### 5) Optional: Blazor Usings
194+
### 5) 🗄️ Database Setup (EF Core)
195+
196+
After configuring UltimateAuth with Entity Framework Core, you need to create and apply database migrations.
197+
198+
5.1) Install EF Core tools (if not installed)
199+
```bash
200+
dotnet tool install --global dotnet-ef
201+
```
202+
5.2) Add migration
203+
```bash
204+
dotnet ef migrations add InitUAuth
205+
```
206+
207+
5.3) Update database
208+
```bash
209+
dotnet ef database update
210+
```
211+
💡 Visual Studio (PMC alternative)
212+
213+
If you are using Visual Studio, you can run these commands in Package Manager Console:
214+
```bash
215+
Add-Migration InitUAuth -Context UAuthDbContext
216+
Update-Database -Context UAuthDbContext
217+
```
218+
⚠️ Notes
219+
- Migrations must be created in your application project, not in the UltimateAuth packages
220+
- You are responsible for managing migrations in production
221+
- Automatic database initialization is not enabled by default
222+
223+
### 6) Optional: Blazor Usings
111224
Add this in `_Imports.razor`
112225
```csharp
113226
@using CodeBeam.UltimateAuth.Client.Blazor
@@ -181,39 +294,6 @@ UltimateAuth turns Auth into a simple application service — not a separate sys
181294

182295
---
183296

184-
185-
## 📅 Release Timeline (Targeted)
186-
187-
> _Dates reflect targeted milestones and may evolve with community feedback._
188-
189-
### **Q1 2026 — First Release**
190-
- v 0.1.0-preview to v 0.1.0
191-
192-
### **Q2 2026 — Stable Feature Releases**
193-
- v 0.2.0 to v 0.3.0
194-
195-
### **Q3 2026 — General Availability**
196-
- API surface locked
197-
- Production-ready security hardening
198-
- Unified architecture finalized
199-
200-
### **Q4 2026 — v 11.x.x (.NET 11 Alignment Release)**
201-
UltimateAuth adopts .NET platform versioning to align with the broader ecosystem.
202-
203-
---
204-
205-
## 🗺 Roadmap
206-
207-
The project roadmap is actively maintained as a GitHub issue:
208-
209-
👉 https://github.com/CodeBeamOrg/UltimateAuth/issues/8
210-
211-
We keep it up-to-date with current priorities, planned features, and progress.
212-
213-
Feel free to follow, comment, or contribute ideas.
214-
215-
---
216-
217297
## 📘 Documentation
218298

219299
Two documentation experiences will be provided:
@@ -235,22 +315,6 @@ Discussions are open — your ideas matter.
235315

236316
---
237317

238-
## 🛠 Project Status
239-
240-
UltimateAuth core architecture is implemented and validated through the sample application.
241-
242-
We are currently:
243-
244-
- Polishing developer experience
245-
- Reviewing public APIs
246-
- Preparing EF Core integration packages
247-
248-
Preview release is coming soon.
249-
250-
You can check the samples and try what UltimateAuth offers by downloading repo and running locally.
251-
252-
---
253-
254318
## ⭐ Acknowledgements
255319

256320
UltimateAuth is built with love by CodeBeam and shaped by real-world .NET development —

UltimateAuth.slnx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<Solution>
22
<Folder Name="/Packages/">
3-
<Project Path="nuget/CodeBeam.UltimateAuth.EntityFrameworkCore/CodeBeam.UltimateAuth.EntityFrameworkCoreReference.csproj" Id="764569b4-dd5b-4a18-a332-7307d20ee21a" />
3+
<Project Path="nuget/CodeBeam.UltimateAuth.EntityFrameworkCore/CodeBeam.UltimateAuth.EntityFrameworkCore.Bundle.csproj" Id="764569b4-dd5b-4a18-a332-7307d20ee21a" />
44
<Project Path="nuget/CodeBeam.UltimateAuth.InMemory/CodeBeam.UltimateAuth.InMemory.Bundle.csproj" />
55
<Project Path="nuget/CodeBeam.UltimateAuth.Reference.Bundle/CodeBeam.UltimateAuth.Reference.Bundle.csproj" Id="f01dee6a-a60d-40a2-bb6a-9894b03e7122" />
66
</Folder>
77
<Folder Name="/Samples/">
8+
<Project Path="samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore.csproj" Id="84201d45-0298-4bf3-9bd4-0567b373f6a0" />
89
<Project Path="samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/CodeBeam.UltimateAuth.Sample.BlazorServer.csproj" />
910
<Project Path="samples/blazor-standalone-wasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm.csproj" Id="27bd3c4d-65a9-4c70-a6c9-4178b1897730" />
11+
<Project Path="samples/CodeBeam.UltimateAuth.Sample.Seed/CodeBeam.UltimateAuth.Sample.Seed.csproj" Id="c79b227b-409e-439d-97df-8979a3dc1a60" />
1012
<Project Path="samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi/CodeBeam.UltimateAuth.Sample.ResourceApi.csproj" Id="3d877c9b-65eb-45be-b259-431b2d386736" />
1113
<Project Path="samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.csproj" Id="ae5368ee-10aa-4c75-9653-a7f481849834" />
1214
</Folder>

nuget/CodeBeam.UltimateAuth.EntityFrameworkCore/CodeBeam.UltimateAuth.EntityFrameworkCoreReference.csproj renamed to nuget/CodeBeam.UltimateAuth.EntityFrameworkCore/CodeBeam.UltimateAuth.EntityFrameworkCore.Bundle.csproj

File renamed without changes.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using CodeBeam.UltimateAuth.Authentication.EntityFrameworkCore;
2+
using CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore;
3+
using CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore;
4+
using CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore;
5+
using CodeBeam.UltimateAuth.Tokens.EntityFrameworkCore;
6+
using CodeBeam.UltimateAuth.Users.EntityFrameworkCore;
7+
using Microsoft.EntityFrameworkCore;
8+
9+
namespace CodeBeam.UltimateAuth.EntityFrameworkCore;
10+
11+
public sealed class UAuthDbContext : DbContext
12+
{
13+
public UAuthDbContext(DbContextOptions<UAuthDbContext> options)
14+
: base(options)
15+
{
16+
}
17+
18+
// Users
19+
public DbSet<UserLifecycleProjection> UserLifecycles => Set<UserLifecycleProjection>();
20+
public DbSet<UserProfileProjection> UserProfiles => Set<UserProfileProjection>();
21+
public DbSet<UserIdentifierProjection> UserIdentifiers => Set<UserIdentifierProjection>();
22+
23+
// Credentials
24+
public DbSet<PasswordCredentialProjection> PasswordCredentials => Set<PasswordCredentialProjection>();
25+
26+
// Authorization
27+
public DbSet<RoleProjection> Roles => Set<RoleProjection>();
28+
public DbSet<RolePermissionProjection> UserRoleAssignments => Set<RolePermissionProjection>();
29+
public DbSet<UserRoleProjection> UserPermissions => Set<UserRoleProjection>();
30+
31+
// Sessions
32+
public DbSet<SessionRootProjection> Roots => Set<SessionRootProjection>();
33+
public DbSet<SessionChainProjection> Chains => Set<SessionChainProjection>();
34+
public DbSet<SessionProjection> Sessions => Set<SessionProjection>();
35+
36+
// Tokens
37+
public DbSet<RefreshTokenProjection> RefreshTokens => Set<RefreshTokenProjection>();
38+
39+
// Authentication
40+
public DbSet<AuthenticationSecurityStateProjection> AuthenticationSecurityStates => Set<AuthenticationSecurityStateProjection>();
41+
42+
protected override void OnModelCreating(ModelBuilder modelBuilder)
43+
{
44+
base.OnModelCreating(modelBuilder);
45+
46+
UAuthSessionsModelBuilder.Configure(modelBuilder);
47+
UAuthTokensModelBuilder.Configure(modelBuilder);
48+
UAuthAuthenticationModelBuilder.Configure(modelBuilder);
49+
UAuthUsersModelBuilder.Configure(modelBuilder);
50+
UAuthCredentialsModelBuilder.Configure(modelBuilder);
51+
UAuthAuthorizationModelBuilder.Configure(modelBuilder);
52+
}
53+
}

nuget/CodeBeam.UltimateAuth.EntityFrameworkCore/UltimateAuthEntityFrameworkCoreExtensions.cs renamed to nuget/CodeBeam.UltimateAuth.EntityFrameworkCore/Extensions/UltimateAuthEntityFrameworkCoreExtensions.cs

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
using CodeBeam.UltimateAuth.Authentication.EntityFrameworkCore.Extensions;
1+
using CodeBeam.UltimateAuth.Authentication.EntityFrameworkCore;
2+
using CodeBeam.UltimateAuth.Authentication.EntityFrameworkCore.Extensions;
3+
using CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore;
24
using CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.Extensions;
5+
using CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore;
36
using CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.Extensions;
47
using CodeBeam.UltimateAuth.Reference.Bundle;
8+
using CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore;
59
using CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.Extensions;
10+
using CodeBeam.UltimateAuth.Tokens.EntityFrameworkCore;
611
using CodeBeam.UltimateAuth.Tokens.EntityFrameworkCore.Extensions;
12+
using CodeBeam.UltimateAuth.Users.EntityFrameworkCore;
713
using CodeBeam.UltimateAuth.Users.EntityFrameworkCore.Extensions;
814
using Microsoft.EntityFrameworkCore;
915
using Microsoft.Extensions.DependencyInjection;
@@ -56,14 +62,9 @@ public static class UltimateAuthEntityFrameworkCoreExtensions
5662
/// </remarks>
5763
public static IServiceCollection AddUltimateAuthEntityFrameworkCore(this IServiceCollection services, Action<DbContextOptionsBuilder> configureDb)
5864
{
59-
services
60-
.AddUltimateAuthReferences()
61-
.AddUltimateAuthUsersEntityFrameworkCore(configureDb)
62-
.AddUltimateAuthCredentialsEntityFrameworkCore(configureDb)
63-
.AddUltimateAuthAuthorizationEntityFrameworkCore(configureDb)
64-
.AddUltimateAuthSessionsEntityFrameworkCore(configureDb)
65-
.AddUltimateAuthTokensEntityFrameworkCore(configureDb)
66-
.AddUltimateAuthAuthenticationEntityFrameworkCore(configureDb);
65+
services.AddUltimateAuthReferences();
66+
services.AddDbContext<UAuthDbContext>(configureDb);
67+
services.AddUltimateAuthEfCoreStores();
6768

6869
return services;
6970
}
@@ -91,13 +92,24 @@ public static IServiceCollection AddUltimateAuthEntityFrameworkCore(this IServic
9192

9293
services
9394
.AddUltimateAuthReferences()
94-
.AddUltimateAuthUsersEntityFrameworkCore(options.Resolve(options.Users))
95-
.AddUltimateAuthCredentialsEntityFrameworkCore(options.Resolve(options.Credentials))
96-
.AddUltimateAuthAuthorizationEntityFrameworkCore(options.Resolve(options.Authorization))
97-
.AddUltimateAuthSessionsEntityFrameworkCore(options.Resolve(options.Sessions))
98-
.AddUltimateAuthTokensEntityFrameworkCore(options.Resolve(options.Tokens))
99-
.AddUltimateAuthAuthenticationEntityFrameworkCore(options.Resolve(options.Authentication));
95+
.AddUltimateAuthUsersEntityFrameworkCore<UAuthUserDbContext>(options.Resolve(options.Users))
96+
.AddUltimateAuthCredentialsEntityFrameworkCore<UAuthCredentialDbContext>(options.Resolve(options.Credentials))
97+
.AddUltimateAuthAuthorizationEntityFrameworkCore<UAuthAuthorizationDbContext>(options.Resolve(options.Authorization))
98+
.AddUltimateAuthSessionsEntityFrameworkCore<UAuthSessionDbContext>(options.Resolve(options.Sessions))
99+
.AddUltimateAuthTokensEntityFrameworkCore<UAuthTokenDbContext>(options.Resolve(options.Tokens))
100+
.AddUltimateAuthAuthenticationEntityFrameworkCore<UAuthAuthenticationDbContext>(options.Resolve(options.Authentication));
100101

101102
return services;
102103
}
104+
105+
public static IServiceCollection AddUltimateAuthEfCoreStores(this IServiceCollection services)
106+
{
107+
return services
108+
.AddUltimateAuthUsersEntityFrameworkCore<UAuthDbContext>()
109+
.AddUltimateAuthSessionsEntityFrameworkCore<UAuthDbContext>()
110+
.AddUltimateAuthTokensEntityFrameworkCore<UAuthDbContext>()
111+
.AddUltimateAuthAuthorizationEntityFrameworkCore<UAuthDbContext>()
112+
.AddUltimateAuthCredentialsEntityFrameworkCore<UAuthDbContext>()
113+
.AddUltimateAuthAuthenticationEntityFrameworkCore<UAuthDbContext>();
114+
}
103115
}

nuget/CodeBeam.UltimateAuth.EntityFrameworkCore/UAuthEfCoreOptions.cs renamed to nuget/CodeBeam.UltimateAuth.EntityFrameworkCore/Options/UAuthEfCoreOptions.cs

File renamed without changes.

0 commit comments

Comments
 (0)