Skip to content

Commit

Permalink
Added disallowedHeadRequestHandler policy and setup routes to use it …
Browse files Browse the repository at this point in the history
…when a head request is made to the begin_oidc endpoint as the OIDC library errors when a head request is made (#2241)
  • Loading branch information
andrewbrazzatti authored Jun 24, 2024
1 parent b82dfaf commit 658d4d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/policies/disallowedHeadRequestHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function (req, res, next) {
if (req.method === 'HEAD') {
return res.badRequest('Bad Request: HEAD method is not allowed');;
}
return next();
};
3 changes: 3 additions & 0 deletions config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ module.exports.routes = {
action: 'openIdConnectLogin',
csrf: false
},
'HEAD /user/begin_oidc': {
policy: 'disallowedHeadRequestHandler'
},
'get /user/begin_oidc': {
controller: 'UserController',
action: 'beginOidc',
Expand Down

0 comments on commit 658d4d4

Please sign in to comment.