Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
farrell-m committed May 30, 2024
1 parent efd3ce2 commit a862d2f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,36 @@

import java.io.IOException;

/**
* Exception Handler for requests that have been authenticated, but do not have sufficient privileges to access
* the requested endpoint.
*/
@Slf4j
@Component
public class ApiAccessDeniedHandler implements AccessDeniedHandler {

ObjectMapper objectMapper;

/**
* Creates an instance of the handler, with an object mapper to write the request body.
*
* @param objectMapper for writing the request body.
*/
@Autowired
ApiAccessDeniedHandler(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
}

/**
* Constructs the response object to return to the client, with a 403 Forbidden status and matching
* response body using the {@link ErrorResponse} model.
*
* @param request that resulted in an <code>AccessDeniedException</code>
* @param response so that the client can be advised of the failure
* @param accessDeniedException that caused the invocation
* @throws IOException -
* @throws ServletException -
*/
@Override
public void handle(HttpServletRequest request, HttpServletResponse response,
AccessDeniedException accessDeniedException) throws IOException, ServletException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected ApiAuthenticationFilter(ApiAuthenticationService authenticationService
}

/**
* Filter reponsible for authenticating the client the made the request. Successful authentication results in the
* Filter reponsible for authenticating the client which made the request. Successful authentication results in the
* authentication details being stored in the security context for further processing, and continuation of the
* filter chain. Unsuccessful authentication results in a 401 UNAUTHORIZED response.
*
Expand Down

0 comments on commit a862d2f

Please sign in to comment.