🧪 test: add JWT edge case scenarios with validation endpoint

- Add expired JWT token scenario

- Add wrong secret JWT token scenario

- Add malformed JWT token scenario

- Implement /api/v1/auth/validate endpoint

- Add JWT parsing and validation to BDD steps

Generated by Mistral Vibe.

Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-04-07 18:21:56 +02:00
parent 81e0afe1c7
commit f39a0df338
15 changed files with 1012 additions and 405 deletions

View File

@@ -127,4 +127,26 @@ Feature: User Authentication
And I should receive a valid JWT token
When I validate the received JWT token
Then the token should be valid
And it should contain the correct user ID
And it should contain the correct user ID
Scenario: Authentication with expired JWT token
Given the server is running
And a user "expireduser" exists with password "testpass123"
When I authenticate with username "expireduser" and password "testpass123"
Then the authentication should be successful
And I should receive a valid JWT token
When I use an expired JWT token for authentication
Then the authentication should fail
And the response should contain error "invalid_token"
Scenario: Authentication with JWT token signed with wrong secret
Given the server is running
When I use a JWT token signed with wrong secret for authentication
Then the authentication should fail
And the response should contain error "invalid_token"
Scenario: Authentication with malformed JWT token
Given the server is running
When I use a malformed JWT token for authentication
Then the authentication should fail
And the response should contain error "invalid_token"