Fix: Implement Validate Method in ZitadelStrategy #90
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.
Fix: Implement PassportStrategy's Abstract validate Method in ZitadelStrategy
Problem:
When a developer tries to run the server with npm run start:dev - they run into an exception error
ERROR in ./libs/zitadel-auth/src/strategy/zitadel.strategy.ts:9:14
TS2515: Non-abstract class 'ZitadelStrategy' does not implement inherited abstract member validate from class 'ZitadelIntrospectionStrategy & PassportStrategyMixin'.
Solution:
This patch addresses a critical requirement by implementing the abstract
validate
method within theZitadelStrategy
class. Thevalidate
method is mandated by thePassportStrategyMixin
abstract class, which is part of the@nestjs/passport
library. By implementing this method, we ensure that our Zitadel authentication strategy correctly adheres to the Passport framework's expected structure and lifecycle.Currently, the implemented
validate
method performs a minimal operation: it receives the user payload (of typeZitadelUser
) and returns it without modification. This provides a functional baseline that satisfies the abstract method's requirement.Changes:
validate
method inzitadel.strategy.ts
, fulfilling the abstract method requirement fromPassportStrategyMixin
.Rationale:
The
validate
method serves as the hook for processing and validating user information retrieved from the authentication provider (in this case, ZITADEL). By implementing this method, we gain the ability to:This initial implementation provides a necessary foundation for future enhancements to the Zitadel authentication strategy.
Next Steps:
validate
method based on application requirements.