Description
In DeviceTelemetryRestController.save(), when the security authentication context is null, not authenticated, or the principal name is blank, the controller throws an EnduranceTrioException with EnduranceTrioError.NOT_FOUND (HTTP 404).
A missing or invalid authentication context should result in HTTP 401 (Unauthorized) or HTTP 403 (Forbidden), not HTTP 404 (Not Found). The NOT_FOUND response code is semantically incorrect for an authentication failure.
File affected:
endurancetrio-app/src/main/java/com/endurancetrio/app/tracker/api/DeviceTelemetryRestController.java
(lines 99–108)
Acceptance Criteria
Description
In
DeviceTelemetryRestController.save(), when the security authentication context is null, not authenticated, or the principal name is blank, the controller throws anEnduranceTrioExceptionwithEnduranceTrioError.NOT_FOUND(HTTP 404).A missing or invalid authentication context should result in HTTP 401 (Unauthorized) or HTTP 403 (Forbidden), not HTTP 404 (Not Found). The NOT_FOUND response code is semantically incorrect for an authentication failure.
File affected:
endurancetrio-app/src/main/java/com/endurancetrio/app/tracker/api/DeviceTelemetryRestController.java(lines 99–108)
Acceptance Criteria
EnduranceTrioError.UNAUTHORIZED(or equivalent)instead of
EnduranceTrioError.NOT_FOUNDEnduranceTrioError.UNAUTHORIZEDdoes not exist in theEnduranceTrioErrorenum,it is added with the appropriate HTTP 401 mapping