@PostMapping(value = RestProtocolConstants.ENDPOINT_USERS,
        consumes = {
            MediaType.APPLICATION_FORM_URLENCODED_VALUE,
            MediaType.APPLICATION_JSON_VALUE
        },
        produces = {
            MediaType.APPLICATION_FORM_URLENCODED_VALUE,
            MediaType.APPLICATION_JSON_VALUE
        })
    @Operation(summary = "Authenticate user credentials",
        parameters = @Parameter(name = "requestBody", required = true, description = "Username and password values"))
    public ResponseEntity<String> authenticateRequest(@RequestBody final MultiValueMap<String, String> requestBody,
                                                      final HttpServletRequest request,
                                                      final HttpServletResponse response) throws Throwable {
        try {
            val authenticationResult = authenticationService.authenticate(requestBody, request, response);
            val result = authenticationResult.orElseThrow(FailedLoginException::new);
            return this.userAuthenticationResourceEntityResponseFactory.build(result, request);
        } catch (final AuthenticationException e) {
            return RestResourceUtils.createResponseEntityForAuthnFailure(e, request, applicationContext);
        } catch (final BadRestRequestException e) {
            LoggingUtils.error(LOGGER, e);
            return new ResponseEntity<>(StringEscapeUtils.escapeHtml4(e.getMessage()), HttpStatus.BAD_REQUEST);
        } catch (final Exception e) {
            LoggingUtils.error(LOGGER, e);
            return new ResponseEntity<>(StringEscapeUtils.escapeHtml4(e.getMessage()), HttpStatus.INTERNAL_SERVER_ERROR);
        }
    }
Authenticate requests.

@param requestBody username and password application/x-www-form-urlencoded values
@param request     raw HttpServletRequest used to call this method
@param response    the response
@return ResponseEntity representing RESTful response
support/cas-server-support-rest-core/src/main/java/org/apereo/cas/support/rest/resources/UserAuthenticationResource.java