diff options
Diffstat (limited to 'daggerhart-openid-connect-generic/readme.md')
-rw-r--r--[-rwxr-xr-x] | daggerhart-openid-connect-generic/readme.md | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/daggerhart-openid-connect-generic/readme.md b/daggerhart-openid-connect-generic/readme.md index 5bf8c0c..5575267 100755..100644 --- a/daggerhart-openid-connect-generic/readme.md +++ b/daggerhart-openid-connect-generic/readme.md @@ -21,6 +21,7 @@ Much of the documentation can be found on the Settings > OpenID Connect Generic - [Frequently Asked Questions](#frequently-asked-questions) - [What is the client's Redirect URI?](#what-is-the-clients-redirect-uri) - [Can I change the client's Redirect URI?](#can-i-change-the-clients-redirect-uri) +- [Configuration Environment Variables/Constants](#configuration-environment-variables-constants) - [Hooks](#hooks) - [Filters](#filters) - [openid-connect-generic-alter-request](#openid-connect-generic-alter-request) @@ -36,6 +37,7 @@ Much of the documentation can be found on the Settings > OpenID Connect Generic - [openid-connect-generic-user-update](#openid-connect-generic-user-update) - [openid-connect-generic-update-user-using-current-claim](#openid-connect-generic-update-user-using-current-claim) - [openid-connect-generic-redirect-user-back](#openid-connect-generic-redirect-user-back) + - [openid-connect-generic-register-login-form](#openid-connect-generic-register-login-form) ## Installation @@ -73,6 +75,15 @@ On the settings page for this plugin (Dashboard > Settings > OpenID Connect Gene **Alternate Redirect URI**. When checked, the plugin will use the Redirect URI `https://example.com/openid-connect-authorize`. +## Configuration Environment Variables/Constants + +- Client ID: `OIDC_CLIENT_ID` +- Client Secret Key: `OIDC_CLIENT_SECRET` +- Login Endpoint URL: `OIDC_ENDPOINT_LOGIN_URL` +- Userinfo Endpoint URL: `OIDC_ENDPOINT_USERINFO_URL` +- Token Validation Endpoint URL: `OIDC_ENDPOINT_TOKEN_URL` +- End Session Endpoint URL: `OIDC_ENDPOINT_LOGOUT_URL` + ## Hooks This plugin provides a number of hooks to allow for a significant amount of customization of the plugin operations from @@ -356,6 +367,38 @@ add_action('openid-connect-generic-redirect-user-back', function( $redirect_url, }, 10, 2); ``` + +#### `openid-connect-generic-register-login-form` + +Allow user to add the login form to various pages, such as WooCommerce's checkout page. It will fire +whenever the plugin is loaded and pass the login form to the callback. + +Provides 1 argument: the login form instance. + +``` +add_action ('openid-connect-generic-register-login-form', + function ( $login_form ) { + + // show login form at the shopping cart (if not logged in) + add_action( 'woocommerce_before_checkout_billing_form', + function () use ( $login_form ) { + $user = wp_get_current_user (); + if (0 == $user->ID) { + // ID 0 is used to indicate user is not logged in. + // Re-use filter logic to generate login page + print ( $login_form->handle_login_page ('') ); + } + }); + + // Add action to set cookie to redirect back to current + // (checkout) page after OIDC provided the data + add_action( 'woocommerce_before_checkout_billing_form', + array( $login_form, 'handle_redirect_cookie' ) ); + + } +); +``` + ### User Meta Data This plugin stores meta data about the user for both practical and debugging purposes. |