HopFrame.Security 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package HopFrame.Security --version 1.1.0                
NuGet\Install-Package HopFrame.Security -Version 1.1.0                
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="HopFrame.Security" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HopFrame.Security --version 1.1.0                
#r "nuget: HopFrame.Security, 1.1.0"                
#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.
// Install HopFrame.Security as a Cake Addin
#addin nuget:?package=HopFrame.Security&version=1.1.0

// Install HopFrame.Security as a Cake Tool
#tool nuget:?package=HopFrame.Security&version=1.1.0                

HopFrame Security module

this module contains all handlers for the login and register validation. It also checks the user permissions.

Services added in this module

You can use these services by specifying them as a dependency. All of them are scoped dependencies.

ITokenContext

This service provides the information given by the current request

public interface ITokenContext {
    bool IsAuthenticated { get; }
    
    User User { get; }
    
    Guid AccessToken { get; }
}

IUserService

This service simplifies the data access of the user table in the database.

public interface IUserService {
    Task<IList<User>> GetUsers();

    Task<User> GetUser(Guid userId);

    Task<User> GetUserByEmail(string email);

    Task<User> GetUserByUsername(string username);
    
    Task<User> AddUser(UserRegister user);

    Task UpdateUser(User user);

    Task DeleteUser(User user);

    Task<bool> CheckUserPassword(User user, string password);

    Task ChangePassword(User user, string password);
}

IPermissionService

This service handles all permission and group interactions with the data source.

public interface IPermissionService {
    Task<bool> HasPermission(string permission, Guid user);

    Task<IList<PermissionGroup>> GetPermissionGroups();

    Task<PermissionGroup> GetPermissionGroup(string name);

    Task EditPermissionGroup(PermissionGroup group);

    Task<IList<PermissionGroup>> GetUserPermissionGroups(User user);

    Task RemoveGroupFromUser(User user, PermissionGroup group);

    Task<PermissionGroup> CreatePermissionGroup(string name, bool isDefault = false, string description = null);

    Task DeletePermissionGroup(PermissionGroup group);

    Task<Permission> GetPermission(string name, IPermissionOwner owner);

    Task AddPermission(IPermissionOwner owner, string permission);

    Task RemovePermission(Permission permission);

    Task<string[]> GetFullPermissions(string user);
}
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on HopFrame.Security:

Package Downloads
HopFrame.Api

Package Description

HopFrame.Web

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 80 11/23/2024
1.1.0 108 9/26/2024
1.0.0 103 8/4/2024