public static String getClientIdFromAuthenticatedProfile(final UserProfile profile) {
        val attrs = new HashMap<>(profile.getAttributes());
        if (attrs.containsKey(OAuth20Constants.CLIENT_ID)) {
            val attribute = attrs.get(OAuth20Constants.CLIENT_ID);
            return CollectionUtils.toCollection(attribute, ArrayList.class).getFirst().toString();
        }
        return null;
    }
Gets client id from authenticated profile.

@param profile the profile
@return the client id from authenticated profile
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java