DX.Blazor.Identity
26.1.3.30
dotnet add package DX.Blazor.Identity --version 26.1.3.30
NuGet\Install-Package DX.Blazor.Identity -Version 26.1.3.30
<PackageReference Include="DX.Blazor.Identity" Version="26.1.3.30" />
<PackageVersion Include="DX.Blazor.Identity" Version="26.1.3.30" />
<PackageReference Include="DX.Blazor.Identity" />
paket add DX.Blazor.Identity --version 26.1.3.30
#r "nuget: DX.Blazor.Identity, 26.1.3.30"
#:package DX.Blazor.Identity@26.1.3.30
#addin nuget:?package=DX.Blazor.Identity&version=26.1.3.30
#tool nuget:?package=DX.Blazor.Identity&version=26.1.3.30
DX.Blazor.Identity
Shared authentication contracts and models used by both DX.Blazor.Identity.Server and DX.Blazor.Identity.Wasm — install this package (it comes in transitively with either of those) to get the IAuthService/ITokenService interfaces and the request/response models your Blazor components bind to. This package alone doesn't implement anything; it's the shared "wire format" both sides agree on.
Target frameworks: net9.0, net10.0
DevExpress dependency: transitive, via DX.Data.Xpo.Identity (26.1.*)
Install
Normally installed transitively via DX.Blazor.Identity.Server or DX.Blazor.Identity.Wasm:
dotnet add package DX.Blazor.Identity.Server # Blazor Server / hosted WASM API project
dotnet add package DX.Blazor.Identity.Wasm # Blazor WASM client project
IAuthService (IAuthService.cs)
public interface IAuthService<TRegistrationModel, TAuthenticationModel>
{
Task<RegistrationResponseModel> RegisterUser(TRegistrationModel userForRegistration);
Task<AuthResponseModel> Login(TAuthenticationModel userForAuthentication);
Task Logout();
Task<string> RefreshToken();
}
public interface IAuthService<TRegistrationModel> : IAuthService<TRegistrationModel, AuthenticationModel> { }
public interface IAuthService : IAuthService<RegistrationModel, AuthenticationModel> { }
This is what your Blazor components (Login.razor, Register.razor, ...) inject and call — AuthenticationService<...> in DX.Blazor.Identity.Server (redirect-based Server flow) and DX.Blazor.Identity.Wasm.Services.AuthenticationService (token/localStorage-based WASM flow) are the two concrete implementations, registered under the same IAuthService interface so your Razor markup doesn't need to know or care which hosting model it's running under.
ITokenService<TKey, TUser> (ITokenService.cs)
public interface ITokenService<TKey, TUser> where TUser : IdentityUser<TKey>, IIdentityRefreshToken
{
SigningCredentials GetSigningCredentials();
Task<List<Claim>> GetClaims(TUser user);
JwtSecurityToken GenerateTokenOptions(SigningCredentials signingCredentials, List<Claim> claims);
string GenerateRefreshToken();
ClaimsPrincipal GetPrincipalFromExpiredToken(string token);
}
Implemented by DX.Blazor.Identity.Wasm.Services.TokenService<TKey, TUser> — reads JwtSettings:securityKey/validIssuer/validAudience/expiryInMinutes from IConfiguration to mint and validate JWTs. The IIdentityRefreshToken constraint on TUser (defined in DX.Data) means your ApplicationUser needs RefreshToken/RefreshTokenExpiryTime properties — DX.Data.Xpo.Identity's IXPUser<TKey> already has these, so the default XPO-backed user model works out of the box.
Models (Models/AuthenticationModels.cs)
public class RegistrationModel { string Email; string Password; string ConfirmPassword; string ReturnUrl; } // + DataAnnotations
public class RegistrationResponseModel { bool IsSuccessfulRegistration; IEnumerable<string> Errors; }
public class AuthenticationModel { string Email; string Password; bool RememberMe; string ReturnUrl; }
public class AuthResponseModel { bool IsAuthSuccessful; string ErrorMessage; string Token; string RefreshToken; }
public class RefreshTokenModel { string Token; string RefreshToken; }
These are the DTOs that cross the wire between the WASM client and the server API (Accounts/Registration, Accounts/Login, token/refresh) — see DX.Blazor.Identity.Wasm's AuthenticationService for the client-side HTTP calls and DX.Blazor.Identity.Server's AuthenticationControllerBase/TokenControllerBase for the server-side handlers.
Notes
ApplicationState.cscurrently only definesInitialApplicationState { AccessToken, RefreshToken }— a commented-outApplicationStateclass remains in the file as a placeholder for future use.- See the root README for the full Blazor Server and Blazor Hosted WASM setup walkthrough (DI registration, controllers, and a sample Login.razor).
See the root README for the full package list and DevExpress version alignment notes.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- DX.Data.Xpo.Identity (>= 26.1.3.37)
- DX.Utils (>= 26.1.3.40)
- Microsoft.IdentityModel.Tokens (>= 8.22.0)
- System.IdentityModel.Tokens.Jwt (>= 8.22.0)
-
net9.0
- DX.Data.Xpo.Identity (>= 26.1.3.37)
- DX.Utils (>= 26.1.3.40)
- Microsoft.IdentityModel.Tokens (>= 8.22.0)
- System.IdentityModel.Tokens.Jwt (>= 8.22.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on DX.Blazor.Identity:
| Package | Downloads |
|---|---|
|
DX.Blazor.Identity.Server
Identity helper and configuration for Blazor Server based authorization |
|
|
DX.Blazor.Identity.Wasm
Identity helper and configuration for Blazor WASM token based authorization |
GitHub repositories
This package is not used by any popular GitHub repositories.
v26.1.3.30: Rebuilt against DX.Data.Xpo.Identity 26.1.3.37 to pick up the System.Security.Cryptography.Xml 8.0.4 fix (NU1903) transitively.
v26.1.3.29: Added a README.md with technical documentation, now embedded in the package via PackageReadmeFile.
v26.1.3.28: Rebuilt against DX.Data.Xpo.Identity 26.1.3.35 to pick up DevExpress v26.1.3 transitively.
v23.2.3.24: Upgraded to .NET 8 and DX v23.2
v23.2.3.23: Upgraded to .NET 8 and DX v23.2
v22.1.4.21: Small fix on refresh token
v22.1.4.20: Upgraded several packages
v22.1.4.19: Upgraded several packages incl DevExpress v21.1.4
v21.2.8.18: New package (with Server and WASM packages) to easily implement Identity with XPO on Blazor Server and WASM