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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to