feat(authentication): ROSS-177: refactored, cleaned, improved auth config related code, added MFA support#65
Merged
Merged
Conversation
Replace flat auth config (auth.enableAuth, auth.authEngine,
auth.authModel, auth.apiKey, auth.jwtSecret) with a provider-based
authentication structure:
- authentication.enabled (boolean)
- authentication.provider.type ('up-auth' | 'api-key')
- authentication.provider.config.userModel (model, idField,
usernameField, passwordField)
- authentication.provider.config.jwtSecret
- authentication.provider.config.key
All config consumers, validators, route guards, security schemas,
and tests updated accordingly.
…l string SEC-5: resolveEnvVars silently returned the literal 'env:VARNAME' string when the environment variable was not set. For sensitive fields like jwtSecret or apiKey this would use a trivially guessable credential. Now throws with a clear error message at config load time, before the server starts. Includes guard for empty env var name.
…del only BUG-2: UserModel field existence (idField, usernameField, passwordField) was validated against ALL models, not just the model referenced by userModel.model. A config pointing at model 'users' with idField 'user_id' would pass because 'user_id' exists in the 'posts' model. Now finds the target model via config.models.find() once and scopes field checks to its fields only.
…h 32, validate auth field types
… auth plugin fall-through branch
… and split otp-verify routes
…to false, add tests
…chema, force to false in handler
…r, validate-auth, and duration
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.
No description provided.