我的WP multisite有300多个站点,这意味着我需要在Azure AD B2C中存储所有300个redirect\\u URL,但由于重定向URI的最大数量为256,因此此数量的redirect\\u URL无法存储在AD B2C中。
我所做的是当用户通过www.abc1.com/wp-admin, 它首先使用默认重定向URL重定向到B2C登录页面(www.abc.com) 我设定的。验证令牌后,用户将重定向到其站点(www.abc1.com).
但它似乎不起作用。我甚至不确定这是否是将用户重定向到他们希望通过这种方式访问的站点的最佳方法。
//fetch the user\' site id and redirect to the site.
$user_blogs = get_blogs_of_user($userID);
if (!empty($user_blogs)) {
$siteInfo = array();
foreach ($user_blogs as $site_id => $site_values) {
$siteInfo[] = $site_values->siteurl;
}
$redirect_url = $siteInfo[0] ; // to the primary site..
}
// Set cookies to authenticate on WP side
wp_set_auth_cookie($userID);
//Redirect to primary site that assigned to the user
wp_safe_redirect($redirect_url);