private String getClientIdFromRequest() {
        var clientId = requestParameterResolver.resolveRequestParameter(context, OAuth20Constants.CLIENT_ID)
            .map(String::valueOf).orElse(StringUtils.EMPTY);
        if (StringUtils.isBlank(clientId)) {
            val redirectUri = requestParameterResolver.resolveRequestParameter(context, OAuth20Constants.REDIRECT_URI)
                .map(String::valueOf).orElse(StringUtils.EMPTY);
            OAuth20Utils.validateRedirectUri(redirectUri);
            val svc = OAuth20Utils.getRegisteredOAuthServiceByRedirectUri(this.servicesManager, redirectUri);
            clientId = svc != null ? svc.getClientId() : StringUtils.EMPTY;
        }
        return clientId;
    }
This is {@link OAuth20ClientIdAwareProfileManager}.
It saves returns a profile based on client_id from the request.

@author Kirill Gagarski
@author Misagh Moayyed
@since 6.1.0
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/OAuth20ClientIdAwareProfileManager.java