public static boolean checkCallbackValid(final @NonNull RegisteredService registeredService,
                                             final String redirectUri) {
        val matchingStrategy = Optional.of(registeredService).map(RegisteredService::getMatchingStrategy).orElse(null);
        validateRedirectUri(redirectUri);
        if (matchingStrategy == null || !matchingStrategy.matches(registeredService, redirectUri)) {
            LOGGER.error("Unsupported [{}]: [{}] does not match what is defined for registered service: [{}]. "
                    + "Service is considered unauthorized. Verify the service matching strategy used in the service "
                    + "definition is correct and does in fact match the client [{}]",
                OAuth20Constants.REDIRECT_URI, redirectUri, registeredService.getServiceId(), redirectUri);
            return false;
        }
        return true;
    }
Check if the callback url is valid.

@param registeredService the registered service
@param redirectUri       the callback url
@return whether the callback url is valid
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java