@GetMapping(path = OAuth20Constants.BASE_OAUTH20_URL + '/' + OAuth20Constants.PROFILE_URL,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Operation(summary = "Handle user profile request",
        parameters = @Parameter(name = "access_token", in = ParameterIn.QUERY, required = true, description = "Access token"))
    public ResponseEntity<String> handleGetRequest(final HttpServletRequest request,
                                                   final HttpServletResponse response) throws Exception {
        response.setContentType(MediaType.APPLICATION_JSON_VALUE);
        val accessTokenResult = FunctionUtils.doAndHandle(() -> getAccessTokenFromRequest(request));
        if (accessTokenResult == null) {
            LOGGER.error("Unable to get the access token from the request");
            return buildUnauthorizedResponseEntity(OAuth20Constants.INVALID_REQUEST);
        }

        val decodedAccessTokenId = accessTokenResult.getValue();
        if (StringUtils.isBlank(decodedAccessTokenId)) {
            LOGGER.error("Missing required parameter [{}] from the request", OAuth20Constants.ACCESS_TOKEN);
            return buildUnauthorizedResponseEntity(OAuth20Constants.MISSING_ACCESS_TOKEN);
        }

        val accessTokenTicket = FunctionUtils.doAndHandle(() -> {
            val decodedToken = getConfigurationContext().getTicketRegistry().getTicket(decodedAccessTokenId, OAuth20AccessToken.class);
            return decodedToken == null || decodedToken.isExpired() ? null : decodedToken;
        });
        if (accessTokenTicket == null || accessTokenTicket.isExpired()) {
            LOGGER.error("Access token [{}] cannot be found in the ticket registry or has expired.", decodedAccessTokenId);
            return buildUnauthorizedResponseEntity(OAuth20Constants.EXPIRED_ACCESS_TOKEN);
        }
        LoggingUtils.protocolMessage("OAuth/OpenID Connect User Profile Request",
            Map.of("Access Token", decodedAccessTokenId, "Client ID", accessTokenTicket.getClientId()));

        try {
            validateAccessToken(accessTokenResult.getKey(), accessTokenTicket, request, response);
            updateAccessTokenUsage(accessTokenTicket);
            val map = getConfigurationContext().getUserProfileDataCreator().createFrom(accessTokenTicket);
            return getConfigurationContext().getUserProfileViewRenderer().render(map, accessTokenTicket, response);
        } catch (final Throwable e) {
            LoggingUtils.error(LOGGER, e);
            return buildUnauthorizedResponseEntity(OAuth20Constants.INVALID_REQUEST);
        }
    }
Handle request internal response entity.

@param request  the request
@param response the response
@return the response entity
@throws Exception the exception
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/endpoints/OAuth20UserProfileEndpointController.java