Skip to content

Auth infrastructure layer#183

Merged
scraft-official merged 3 commits intorelease/2.25from
feature/auth-infrastructure-layer
Jan 1, 2026
Merged

Auth infrastructure layer#183
scraft-official merged 3 commits intorelease/2.25from
feature/auth-infrastructure-layer

Conversation

@scraft-official
Copy link
Copy Markdown
Collaborator

This pull request introduces a comprehensive infrastructure layer for persisting authentication (Auth) entities, including JPA entity definitions, mapping logic, and repository implementations. It also improves password validation and serialization logic in the domain layer. The most important changes are as follows:

Infrastructure Layer for Auth Entities:

  • Added the new AuthEntity JPA entity, its metadata class, and a repository interface (AuthEntityRepository) for database operations, enabling persistence and retrieval of authentication methods and metadata. [1] [2] [3]
  • Implemented AuthEntityMapper using MapStruct to convert between domain (Auth) and infrastructure (AuthEntity) representations, including custom mapping for authentication methods.
  • Added a JPA attribute converter (AuthMethodSerializedModelConverter) for serializing and deserializing authentication method data to JSON in the database.

Repository Implementation:

  • Replaced the stubbed AuthRepositoryImpl with a full implementation that uses the new infrastructure repository and mapping layer for all CRUD operations, including account and type-based queries.

Domain Layer Improvements:

  • Enhanced the Auth class to implement a new DomainEntity interface, added ownership checks, and improved encapsulation and null-safety. [1] [2] [3]
  • Improved password validation in PasswordAuthMethod by using compiled regex patterns, extracting constants, and enforcing stricter checks for spaces and required character types. (F4dee2cfL4R4, [1] [2] [3]

Serialization Enhancements:

  • Simplified and improved the AuthMethodSerializer to support string serialization with error handling.

Minor Improvements:

  • Added @ToString annotations and minor code cleanups for better debugging and consistency in entity classes. [1] [2] [3] [4]

These changes lay the groundwork for robust authentication persistence and provide a foundation for future enhancements in the authentication domain.

Added AuthEntity, repository, mapper, and converters to support persistence of Auth domain objects. Refactored domain and infrastructure layers to integrate new infrastructure entity, including method serialization and mapping. Updated related classes to use BaseInfrastructureEntity. Enhanced Auth domain model with account ownership checks and method accessors.
Added Lombok's @tostring annotation to various entity and meta classes for better logging and debugging. Refactored password validation logic in PasswordAuthMethod to use constants and regex patterns for improved maintainability and clarity.
Replaces String regex matches with precompiled Pattern objects for password validation, improving performance and readability. Also adds @nonnull annotations to relevant method parameters and removes unnecessary password trimming.
@scraft-official scraft-official merged commit aa3c991 into release/2.25 Jan 1, 2026
2 checks passed
scraft-official added a commit that referenced this pull request Jan 4, 2026
* Implement infrastructure for Auth entity persistence

Added AuthEntity, repository, mapper, and converters to support persistence of Auth domain objects. Refactored domain and infrastructure layers to integrate new infrastructure entity, including method serialization and mapping. Updated related classes to use BaseInfrastructureEntity. Enhanced Auth domain model with account ownership checks and method accessors.

* Add @tostring to entities and improve password validation

Added Lombok's @tostring annotation to various entity and meta classes for better logging and debugging. Refactored password validation logic in PasswordAuthMethod to use constants and regex patterns for improved maintainability and clarity.

* Refactor password validation to use regex Patterns

Replaces String regex matches with precompiled Pattern objects for password validation, improving performance and readability. Also adds @nonnull annotations to relevant method parameters and removes unnecessary password trimming.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants