Yes, the code you have posted requires WordPress to be the SSO provider. The code at the end of it is adding parameters to the SSO payload that is sent from WordPress to Discourse:
add_filter( 'wpdc_sso_params', 'wpdc_wc_memberships_add_to_dc_group' );
Unless you are using WordPress as the SSO provider, the only way to automatically add uses to Discourse groups is to use the Discourse API.