Crates.io | dddk_security |
lib.rs | dddk_security |
version | 0.6.0 |
source | src |
created_at | 2022-01-22 13:26:34.511327 |
updated_at | 2024-02-21 22:27:54.184069 |
description | Security module of dddk_core. Impl features regarding command_bus pattern and security |
homepage | https://github.com/jultabary/4dk-core |
repository | |
max_upload_size | |
id | 519148 |
size | 70,866 |
The lib extends core behaviour with security features.
It implements the entites : SecuredCommand
, SecuredQuery
, SecuredCommandHandler
, SecuredQueryHandler
, SecuredCommandDispatcher
, SecuredQueryDispatcher
.
Extends Command
by decoration. SecuredCommand has to be constructed with user roles.
Extends CommandHandler
by decoration. SecuredHandler is defined with a permission.
Replace the CommandDispatcher
implementation from core-rust
.
When a command is dispatch to the CommandBus
, it will replaces (with RoleReadRepository
impl) user roles by its permissions. Then it will check if user command has the permission to call the handler.
Extends Query
by decoration. SecuredQuery has to be constructed with user roles.
Extends QueryHandler
by decoration. SecuredHandler is defined with a permission.
Replace the QueryDispatcher
implementation from core-rust
.
When a query is dispatch to the QueryBus
, it will replaces (with RoleReadRepository
impl) user roles by its permissions. Then it will check if user query has the permission to call the handler.
You can find in samples different bus composition.