You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "mengw15 (via GitHub)" <gi...@apache.org> on 2026/07/31 12:11:55 UTC
[I] add unit test coverage for AuthResource login/register/JWT [texera]
mengw15 opened a new issue, #7164:
URL: https://github.com/apache/texera/issues/7164
### Task Summary
`AuthResource` (`amber/src/main/scala/org/apache/texera/web/resource/auth/AuthResource.scala`, codecov ~0%) has no spec. It authenticates against the user table (jOOQ) and issues JWTs via `JwtAuth` (pure, deterministic) — both unit-testable on embedded Postgres via `MockTexeraDB` (see #6714). No external auth provider.
### Behavior to add
`class AuthResourceSpec … with MockTexeraDB`; seed users via `UserDao` in `beforeEach`, `new AuthResource()`, cover:
- `retrieveUserByUsernameAndPassword` — returns the user for correct credentials and none/empty for a wrong password or unknown user (assert the password-hash check).
- `login` — for valid credentials returns a `TokenIssueResponse`; assert a JWT is issued (decode via `JwtAuth.jwtClaims` and check the subject/claims), and that invalid credentials are rejected.
- `register` — creates a new user (assert persisted with hashed password) and returns a token; cover the duplicate-username rejection branch.
- `createAdminUser` — creates a user with the admin role; assert the role on the persisted row.
Use `JwtAuth` to verify issued tokens rather than asserting raw strings (deterministic claims, not time-sensitive assertions).
### Task Type
- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [x] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] add unit test coverage for AuthResource login/register/JWT [texera]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #7164:
URL: https://github.com/apache/texera/issues/7164#issuecomment-5142724066
<!-- texera:template-compliance -->
👋 Thanks for opening this issue, @mengw15!
It looks like the issue description doesn't quite follow our template yet:
- This issue doesn't appear to use one of our templates (Bug, Feature, or Task). Please open it using a template so the required details are captured.
Filling out the template helps reviewers understand and triage your contribution faster. Please edit the description to complete it. This message will disappear automatically once the template is followed.
You can find the template prompts by editing the description, or see [CONTRIBUTING.md](https://github.com/apache/texera/blob/main/CONTRIBUTING.md) for the full contribution flow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] add unit test coverage for AuthResource login/register/JWT [texera]
Posted by "mengw15 (via GitHub)" <gi...@apache.org>.
mengw15 closed issue #7164: add unit test coverage for AuthResource login/register/JWT
URL: https://github.com/apache/texera/issues/7164
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org