EasyAuthentication 1.2.2

dotnet add package EasyAuthentication --version 1.2.2
                    
NuGet\Install-Package EasyAuthentication -Version 1.2.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasyAuthentication" Version="1.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EasyAuthentication" Version="1.2.2" />
                    
Directory.Packages.props
<PackageReference Include="EasyAuthentication" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EasyAuthentication --version 1.2.2
                    
#r "nuget: EasyAuthentication, 1.2.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EasyAuthentication@1.2.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EasyAuthentication&version=1.2.2
                    
Install as a Cake Addin
#tool nuget:?package=EasyAuthentication&version=1.2.2
                    
Install as a Cake Tool

About EasyAuthentication :

EasyAuthentication is the clean and realy clear authentication and authorization service. In this project I use Clean architecture and also use MediateR, FluentValidation, AutoMapper and JWT to implement this structure. Totally I developed it after some years of expriences and use a lots of diffrent authentication that we can use Mobile authentication and Email authentication.

How to use :

In the "Configurations" folder and IdentityServicesRegistration we have JwtSettings and IdentityConnectionString that they read from appsettings on your project like following codes:


"ConnectionStrings": {
    "IdentityConnectionString": "Data Source= <DB_IP> ; User Id = <DB_USER> ; Password = <DB_PASSWORD> ; Initial Catalog= <DB_NAME> ;TrustServerCertificate=True"
  },

  "JwtSettings": {
    "Key": "<YOUR_KEY>",
    "Issuer": "<YOUR_ISSUER>",
    "Audience": "<YOUR_AUDIENCE>",
    "DurationInMinutes": 43200//for 30 days
  },

Add this config to your program.cs

 builder.Services.AddDbContext<IdentityDbContext>(options =>
 {
     options.UseSqlServer(configuration
         .GetConnectionString("<YOUR_CONNECTIONSTRING>"), b => b.MigrationsAssembly("<YOUR_PROJECTLAYER>")); 
 });
builder.Services.ConfigureIdentityServices(builder.Configuration);

How to use AuthenticationFeatures :

// register 
await _mediator.Send(new RegisterRequest()
{
    RegisterDto = new RegisterDto()
    {
        Email = "",
        MobileNumber = "",
    }
});

// send auth code to mobile 
await _mediator.Send(new SendAuthCodeRequest()
{
    SendAuthCode = new SendAuthCode()
    {
        MobileNumber = ""
    }
});

// login by auth code
await _mediator.Send(new LoginByAuthCodeRequest()
{
    LoginByAuthCode = new LoginByAuthCode()
    {
        MobileNumber = "",
        ActivationCode = ""
    }
});

// login by pass
await _mediator.Send(new LoginByPassRequest()
{
    LoginByPass = new LoginByPass()
    {
        Email = "",
        MobileNumber = "",
        Password = ""
    }
});

// set pass 
await _mediator.Send(new SetPassRequest()
{
    SetPass = new SetPass()
    {
        UserId = Guid.Empty,
        Pass = "",
        RePass = ""
    }
});

// change pass 
await _mediator.Send(new ChangePassRequest()
{
    ChangePass = new ChangePass()
    {
        ReNewPass = "",
        NewPass = "",
        CurrentPass = "",
        UserId = Guid.Empty
    }
});

How to use RoleFeatures :

await _mediator.Send(new GetRoleListRequest(){});
await _mediator.Send(new GetRoleRequest() { Id = 1 });
await _mediator.Send(new GetUserRolesRequest() { Id = Guid.Empty});

// add or update role
await _mediator.Send(new UpsertRoleRequest()
{
    RoleDto = new RoleDto()
    { 
        Title = "role"
    }
});

// pass roleId
await _mediator.Send(new DeleteRoleRequest(){Id = 1});
// pass userRoleId
await _mediator.Send(new DeleteRoleFromUserRequest(){Id = 1});

await _mediator.Send(new AddRoleToUserRequest(){UserId = Guid.Empty , RoleId = 1});

How to use UserFeatures :

await _mediator.Send(new GetUserListRequest());
await _mediator.Send(new GetUserProfileRequest(){UserId = Guid.Empty});
await _mediator.Send(new GetUserRequest(){Id = Guid.Empty});

await _mediator.Send(new UpsertUserProfileRequest(){UserDto = new UserDto()});
await _mediator.Send(new UpdateUserProfileRequest(){UserProfileDto = new UpdateUserProfileDto()});
await _mediator.Send(new DeleteUserProfileRequest(){RemoveUserDto = new RemoveUserDto(){UserId = Guid.Empty}});
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.2 218 3/4/2024
1.2.1 157 3/4/2024
1.2.0 163 2/22/2024
1.1.1 160 2/6/2024
1.1.0 143 2/6/2024
1.0.3 176 2/6/2024 1.0.3 is deprecated because it has critical bugs.
1.0.2 177 2/2/2024 1.0.2 is deprecated because it has critical bugs.
1.0.1 161 2/2/2024 1.0.1 is deprecated because it has critical bugs.
1.0.0 154 2/2/2024 1.0.0 is deprecated because it has critical bugs.

Upsert user bug fixed