You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When sending a post request to the login page (/identity/api/auth/login), bad credentials result in an exception raised (From springframework?), in function authenticateUser (Raised from calling authenticateUserLogin)
One more issue is that you actually mean to return 500 for an unsuccessful login. i.e
Which doesn't make much sense, but is never reached anyways. The 500 actually derives from an exception, and you have no control over it.
You should wrap the JwtResponse in a try/catch block, and return an HttpStatus.UNAUTHORIZED response accordingly. You also have a string for bad credentials so better use that in the response.
To Reproduce
Send a POST request to /identity/api/auth/login with fake credentials
Expected behavior
An 403 or 401 should've been returned by you and not by an exception raised from the authentication management library.
Runtime Environment
Docker version 20.10.12, build e91ed57
Linux 5.14.0-1033-oem #36-Ubuntu SMP Mon Apr 4 15:15:49 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered:
Description
When sending a post request to the login page (
/identity/api/auth/login
), bad credentials result in an exception raised (From springframework?), in functionauthenticateUser
(Raised from callingauthenticateUserLogin
)One more issue is that you actually mean to return
500
for an unsuccessful login. i.ereturn ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(jwtToken);
Which doesn't make much sense, but is never reached anyways. The
500
actually derives from an exception, and you have no control over it.You should wrap the
JwtResponse
in a try/catch block, and return anHttpStatus.UNAUTHORIZED
response accordingly. You also have a string for bad credentials so better use that in the response.To Reproduce
Send a POST request to
/identity/api/auth/login
with fake credentialsExpected behavior
An
403
or401
should've been returned by you and not by an exception raised from the authentication management library.Runtime Environment
Docker version 20.10.12, build e91ed57
Linux 5.14.0-1033-oem #36-Ubuntu SMP Mon Apr 4 15:15:49 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: