Merged
Conversation
Replaces the previous AuthType and AuthProperties-based authentication model with a new AuthMethod abstraction. Introduces AuthMethod, AuthMethodMeta, and AuthMethodType interfaces, along with a PasswordAuthMethod implementation. Updates Auth entity and related creation meta to use the new structure. Removes obsolete classes related to the old authentication model.
Introduces AuthModificationMeta interface and PasswordChangeModificationMeta implementation to support modifications to Auth entities, specifically password changes. Updates Auth class to handle modification meta, restricts auth method type changes, and adds canAuthenticate utility method.
Introduced the AuthDeletionMeta interface for deletion metadata in the auth domain. Updated the Auth class to handle AuthDeletionMeta during deletion, preparing for future extensibility.
Introduced interfaces and models for serializing and deserializing authentication methods, including AuthMethodSerializer, AuthMethodDeserializer, and AuthMethodSerializedModel. Refactored PasswordAuthMethod to use a new BaseAuthMethod enum for type management and added deserialization logic. Removed the static factory method from AuthMethodType and centralized type definitions in BaseAuthMethod.
Introduced the @nonnull annotation to the 'method' variable in the Auth class constructor to enforce non-nullability and improve code safety.
Renamed the BaseAuthMethod enum to BaseAuthMethodType and updated all references in PasswordAuthMethod. This improves naming consistency and clarity in the authentication method type implementation.
Updated AuthService.create to require accountId and refactored usage in InitialSetupUseCase. Renamed PasswordAuthMeta to PasswordAuthMethodMeta in PasswordAuthMethod for consistency. Also updated import and builder usage to match new class names.
Annotated the passwordHash and salt variables with @nonnull in PasswordAuthMethod to enforce non-nullability and improve code safety.
Collaborator
Author
|
Wszystkie zasoby mojego mózgu zostały tutaj wykorzystane XD, aby nie uciąć sobie drogę na przyszłe wprowadzenie nowych metod, |
NikodemCyrzan
approved these changes
Dec 29, 2025
scraft-official
added a commit
that referenced
this pull request
Jan 4, 2026
* Refactor authentication to use AuthMethod abstraction Replaces the previous AuthType and AuthProperties-based authentication model with a new AuthMethod abstraction. Introduces AuthMethod, AuthMethodMeta, and AuthMethodType interfaces, along with a PasswordAuthMethod implementation. Updates Auth entity and related creation meta to use the new structure. Removes obsolete classes related to the old authentication model. * Add Auth modification meta and password change support Introduces AuthModificationMeta interface and PasswordChangeModificationMeta implementation to support modifications to Auth entities, specifically password changes. Updates Auth class to handle modification meta, restricts auth method type changes, and adds canAuthenticate utility method. * Add AuthDeletionMeta interface and update Auth deletion Introduced the AuthDeletionMeta interface for deletion metadata in the auth domain. Updated the Auth class to handle AuthDeletionMeta during deletion, preparing for future extensibility. * Add serialization support for auth methods Introduced interfaces and models for serializing and deserializing authentication methods, including AuthMethodSerializer, AuthMethodDeserializer, and AuthMethodSerializedModel. Refactored PasswordAuthMethod to use a new BaseAuthMethod enum for type management and added deserialization logic. Removed the static factory method from AuthMethodType and centralized type definitions in BaseAuthMethod. * Add @nonnull annotation to method variable in Auth Introduced the @nonnull annotation to the 'method' variable in the Auth class constructor to enforce non-nullability and improve code safety. * Rename BaseAuthMethod to BaseAuthMethodType Renamed the BaseAuthMethod enum to BaseAuthMethodType and updated all references in PasswordAuthMethod. This improves naming consistency and clarity in the authentication method type implementation. * Refactor auth creation and password auth meta classes Updated AuthService.create to require accountId and refactored usage in InitialSetupUseCase. Renamed PasswordAuthMeta to PasswordAuthMethodMeta in PasswordAuthMethod for consistency. Also updated import and builder usage to match new class names. * Add @nonnull to passwordHash and salt variables Annotated the passwordHash and salt variables with @nonnull in PasswordAuthMethod to enforce non-nullability and improve code safety.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a major refactoring of the authentication domain model, moving from a property/type-based approach to a more extensible and modular "auth method" architecture. The changes enable support for multiple authentication methods, improve separation of concerns, and lay the groundwork for future extensibility. The most important changes are grouped below.
Core Domain Model Refactor
Replaced the old
AuthType/AuthPropertiesmodel with a newAuthMethodabstraction in theAuthentity, allowing authentication logic and data to be encapsulated per method. TheAuthclass now references anAuthMethodand supports method-based creation, modification, and authentication. (Auth.java,AuthMethod.java,AuthMethodType.java,BaseAuthMethod.java,PasswordAuthMethod.java) [1] [2] [3] [4] [5] [6] [7] [8]Removed legacy classes and interfaces:
AuthType,AuthProperties,AuthByPasswordProperties, and their usages. (AuthType.java,AuthProperties.java,AuthByPasswordProperties.java) [1] [2] [3]Authentication Method Abstractions
Introduced the
AuthMethodinterface and supporting types, includingAuthMethodType,AuthMethodMeta, and concrete implementations for password authentication. (AuthMethod.java,PasswordAuthMethod.java,AuthMethodMeta.java,BaseAuthMethodType.java) [1] [2] [3] [4]Added serialization/deserialization infrastructure for auth methods, including
AuthMethodSerializedModel,AuthMethodSerializer, andAuthMethodDeserializer. (AuthMethodSerializedModel.java,AuthMethodSerializer.java,AuthMethodDeserializer.java) [1] [2] [3]Creation/Modification/Deletion Meta Refactor
AuthByPasswordCreationMetawith a genericAuthCreationMetainterface and a password-specific implementation. Analogous interfaces and classes were added for modification and deletion meta, supporting future extensibility for other auth methods. (AuthCreationMeta.java,PasswordAuthCreationMeta.java,AuthModificationMeta.java,PasswordChangeModificationMeta.java,AuthDeletionMeta.java) [1] [2] [3] [4] [5] [6]Exception Handling
AuthenticationExceptionfor more precise error handling during authentication failures. (AuthenticationException.java)Metadata and Utility Enhancements
AuthMetato use Lombok and prepared it for future metadata (e.g., login attempts). (AuthMeta.java)Overall, these changes modernize the authentication infrastructure, making it more modular, extensible, and maintainable, and prepare the codebase for supporting additional authentication methods in the future.