private void configureHttp(final TomcatServletWebServerFactory tomcat) {
        casProperties.getServer().getTomcat().getHttp()
            .stream()
            .filter(CasEmbeddedApacheTomcatHttpProperties::isEnabled)
            .forEach(http -> {
                LOGGER.debug("Creating HTTP configuration for the embedded tomcat container...");
                val connector = new Connector(http.getProtocol());
                var port = http.getPort();
                if (port <= 0) {
                    port = RandomUtils.nextInt(PORT_RANGE_MIN, PORT_RANGE_MAX);
                    LOGGER.warn("No explicit port configuration is provided to CAS. Using random port [{}]", port);
                }
                LOGGER.info("Activated embedded tomcat container HTTP port on [{}]", port);
                connector.setPort(port);
                if (http.getRedirectPort() > 0) {
                    connector.setRedirectPort(http.getRedirectPort());
                }
                connector.setScheme(http.getScheme());
                connector.setSecure(http.isSecure());

                LOGGER.debug("Configuring embedded tomcat container for HTTP2 protocol support");
                connector.addUpgradeProtocol(new Http2Protocol());

                http.getAttributes().forEach(connector::setProperty);
                tomcat.addAdditionalTomcatConnectors(connector);
            });
    }
This is {@link CasTomcatServletWebServerFactoryCustomizer}.

@author Misagh Moayyed
@since 6.1.0
webapp/cas-server-webapp-init-tomcat/src/main/java/org/apereo/cas/tomcat/CasTomcatServletWebServerFactoryCustomizer.java