commit 00d59edb0804583c788996416e22b633ab7bd3fc Author: Mark Sauer Date: Sat Dec 15 20:56:39 2018 +0800 Initial commit diff --git a/gotomyaccounts-sso.zip b/gotomyaccounts-sso.zip new file mode 100644 index 0000000..0d37a84 Binary files /dev/null and b/gotomyaccounts-sso.zip differ diff --git a/gotomyaccounts-sso/gotomyaccounts-sso.php b/gotomyaccounts-sso/gotomyaccounts-sso.php new file mode 100644 index 0000000..1e16d71 --- /dev/null +++ b/gotomyaccounts-sso/gotomyaccounts-sso.php @@ -0,0 +1,39 @@ +user_email; + if ($portalURL != '' && $sso_password != '') + { + try + { + $url = "https://appapi.gotomyaccounts.com/v1/SSO/?email=" . urlencode($email) . "&portal_hostname=" . urlencode($portalURL); + $args = array( + 'method' => 'GET', + 'timeout' => 60, + 'sslverify' => false, + 'headers' => array( "Authorization" => $sso_password ), + 'body' => array(), + 'cookies' => false + ); + $response = wp_safe_remote_get($url, $args); + if (!is_wp_error($response)) + { + $result = $response['response']; + if ($result['code'] == 200 && $result['message'] == 'OK') + { + $token = $response['body']; + } else + { + $token = ''; + } + } else + { + $token = ''; + } + } catch (Exception $exc) + { + $token = ''; + } + } + return $token; + } + + function gtma_redirect() + { + $gtma_redirects = get_option('gtma_sso_redirects', array()); + $ids = array_keys($gtma_redirects); + $token = $this->get_token(); + $portalURL = get_option('gtma_portal_url', ''); + $id = get_the_ID(); + if ((in_array($id, $ids)) && !empty($token) && !empty($portalURL)) + { + $link = "https://" . $portalURL . "/sso?token=" . urlencode($token) . "&page=" . $gtma_redirects[$id]; + wp_redirect($link); + exit; + } + } + +} \ No newline at end of file diff --git a/gotomyaccounts-sso/includes/gtma-settings.php b/gotomyaccounts-sso/includes/gtma-settings.php new file mode 100644 index 0000000..12749d3 --- /dev/null +++ b/gotomyaccounts-sso/includes/gtma-settings.php @@ -0,0 +1,210 @@ +ID] = $page->post_title; +} +?> + + +
+ logo +

GoToMyAccounts Single Sign On Settings

+
+
+ +
+

+ Quick-Start Instructions +

+ Note: In order for SSO to work, your logged in WordPress user must have a corresponding web portal account with the exact same email address. +
    +
  1. Set your web portal address and SSO token
  2. +
  3. + Create empty pages for the portal redirects you desire. (Ex: Billing, Make a payment, Manage Users, etc)
    + (These represent a single "deep link" into your web portal) +
  4. +
  5. Add your pages (links) to one or menus.
  6. +
  7. Click a menu item to test.
  8. +
+

+ Full Documentation +

+
+
+ +
+
"> + + + + + + + + + + + + + + + +
+ + + +

+ Set your GoToMyAccounts portal URL (no http/https or trailing "/").
+ Example: myportal.gotomyaccounts.com +

+
+ + + +

+ Where do I find this? You can manage your SSO tokens from within your portal (when logged in with admin permissions). On the left + menu, click Integrations, then click "SSO Tokens". Copy a token from that page and paste it into this field. +

+
+ Add Redirect + + + +
+ Actual Wordpress pages should not contain any content. The plugin will cause these pages to redirect instead to your Web Portal Redirect Page.
+ If the redirect fails, the page will instead display an error message to the user.
+ Example Web Portal Redirect Pages: "customer_dashboard.html", "payment.html", "customer_manage_users.html" +
+ +
+ + + + + + + +
Redirected Page + + + + + + + + + + $redirect) + { + if ($id) + { + ?> + + + + + + + + + + + +
WordPress Page (should be empty)Web Portal Redirect PageActions
+ + ">
No Redirects Configured
+
+
+
\ No newline at end of file diff --git a/gotomyaccounts-sso/includes/index.php b/gotomyaccounts-sso/includes/index.php new file mode 100644 index 0000000..6220032 --- /dev/null +++ b/gotomyaccounts-sso/includes/index.php @@ -0,0 +1,2 @@ +