Skip to content

Commit 626458a

Browse files
committed
fix: change response status from 404 to 403 for forbidden requests
1 parent c4e06b5 commit 626458a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Project/Sources/Classes/OAuth2Authorization.4dm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ Function getResponse($request : 4D.IncomingMessage) : 4D.OutgoingMessage
2121
$response.setHeader("Content-Type"; "text/html")
2222
Else
2323

24-
$response.setStatus(404)
24+
// Send a 403 status line
25+
// This is not strictly necessary, but it makes it clear that the request was forbidden
26+
// and not just a 404 Not Found
27+
$response.setStatus(403)
28+
var $errorBody : Text:="<html><body><h1>403 Forbidden</h1><p>Access denied</p></body></html>"
29+
$response.setBody($errorBody)
30+
$response.setHeader("Content-Type"; "text/html")
31+
2532
End if
2633
Else
2734
var $error : Object:=cs.Tools.me.makeError(9; {which: "request (4D.IncomingMessage)"; function: "OAuth2Authorization.getResponse"})

0 commit comments

Comments
 (0)