Skip to content

Commit a34c0fe

Browse files
Improve documentation on configuring plugin
1 parent 3c5f3aa commit a34c0fe

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Use OpenID Connect to log in to other webservices using your own WordPress.
1515

1616
With this plugin you can use your own WordPress install to authenticate with a webservice that provides [OpenID Connect](https://openid.net/connect/) to implement Single-Sign On (SSO) for your users.
1717

18-
The plugin is currently only configured using constants and hooks as follows:
18+
After installing plugin on your WordPress website and before activating it, follow the steps below.
1919

2020
### Define the RSA keys
2121

@@ -25,7 +25,7 @@ openssl genrsa -out oidc.key 4096
2525
openssl rsa -in oidc.key -pubout -out public.key
2626
~~~
2727

28-
And make them available to the plugin as follows (this needs to be added before WordPress loads):
28+
And make them available to the plugin as below (this needs to be added before WordPress loads). This should be added to the `wp-config.php` file of your WordPress installation. Note, that it is important to add the `define` statements before the line `require_once ABSPATH . 'wp-settings.php';`. Otherwise, your RSA keys might not be visible to the rest of the WordPress website.
2929

3030
~~~php
3131
define( 'OIDC_PUBLIC_KEY', <<<OIDC_PUBLIC_KEY
@@ -50,7 +50,7 @@ define( 'OIDC_PRIVATE_KEY', file_get_contents( '/web-inaccessible/private.key' )
5050

5151
### Define the clients
5252

53-
Define your clients by adding a filter to `oidc_registered_clients` in a separate plugin file or `functions.php` of your theme or in a MU-plugin like:
53+
Define your clients by adding a filter to `oidc_registered_clients` in a separate plugin file or `functions.php` of your theme or in a MU-plugin as below. The easiest way would be to add filter through WordPress Admin interface by going to Appearance -> Theme file editor -> choose Theme Functions (functions.php) on the right hand side menu. You can add the code to the end of the file before `?>`.
5454
~~~php
5555
add_filter( 'oidc_registered_clients', 'my_oidc_clients' );
5656
function my_oidc_clients() {
@@ -66,6 +66,14 @@ function my_oidc_clients() {
6666
}
6767
~~~
6868

69+
### Check that everything works as expected
70+
You should be able to go to `https://<your_wordpress_domain>/.well-known/openid-configuration`. This endpoint will list the endpoints of the authorization flow. Namely, three endpoints will be defined:
71+
- `https://<your_wordpress_domain>/wp-json/openid-connect/authorize`
72+
- `https://<your_wordpress_domain>/wp-json/openid-connect/token`
73+
- `https://<your_wordpress_domain>/wp-json/openid-connect/userinfo`
74+
75+
`wp-json` is where the REST routes are defined for your WordPress website.
76+
6977
### Exclude URL from caching
7078

7179
- `example.com/wp-json/openid-connect/userinfo`: We implement caching exclusion measures for this endpoint by setting `Cache-Control: 'no-cache'` headers and defining the `DONOTCACHEPAGE` constant. If you have a unique caching configuration, please ensure that you manually exclude this URL from caching.

0 commit comments

Comments
 (0)