[WordPress] 外掛分享: OpenID Connect Server

首頁外掛目錄 › OpenID Connect Server
100+
安裝啟用
尚無評分
334 天前
最後更新
問題解決
WordPress 6.0+ PHP 7.4+ v2.0.0 上架:2022-10-30

內容簡介

使用此外掛,您可以使用自己的 WordPress 安裝與提供 OpenID Connect 的 Web 服務進行身分驗證,以實現使用者的單一登入 (SSO)。

該外掛目前僅使用以下常數和掛鉤配置:

定義 RSA 金鑰

如果您還沒有要使用的金鑰,可以使用以下命令生成:

openssl genrsa -out oidc.key 4096
openssl rsa -in oidc.key -pubout -out public.key

並將其作為以下示例提供給外掛使用 (必須在 WordPress 加載之前添加):

define( 'OIDC_PUBLIC_KEY', <<<OIDC_PUBLIC_KEY
-----BEGIN RSA PUBLIC KEY-----
...
-----END RSA PUBLIC KEY-----
OIDC_PUBLIC_KEY
);

define( 'OIDC_PRIVATE_KEY', <<<OIDC_PRIVATE_KEY
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
OIDC_PRIVATE_KEY
);

或者,您也可以將金鑰放在網頁根目錄以外,並像這樣從文件中加載它們:

define( 'OIDC_PUBLIC_KEY', file_get_contents( '/web-inaccessible/oidc.key' ) );
define( 'OIDC_PRIVATE_KEY', file_get_contents( '/web-inaccessible/private.key' ) );

定義客戶端

通過在單獨的外掛文件、您的主題的 functions.php 或類似 mu-plugin 的 filter 中添加 oidc_registered_clients,來定義您的客戶端:

add_filter( 'oidc_registered_clients', 'my_oidc_clients' );
function my_oidc_clients() {
return array(
'client_id_random_string' => array(
'name' => '客戶端名稱',
'secret' => '秘密字串',
'redirect_uri' => 'https://example.com/redirect.uri',
'grant_types' => array( 'authorization_code' ),
'scope' => 'openid profile',
),
);
}

Github 存儲庫

您可以直接在 Github 存儲庫:Automattic/wp-openid-connect-server 上報告您遇到的任何問題。

外掛標籤

開發者團隊

⬇ 下載最新版 (v2.0.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「OpenID Connect Server」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

With this plugin you can use your own WordPress install to authenticate with a webservice that provides OpenID Connect to implement Single-Sign On (SSO) for your users.
The plugin is currently only configured using constants and hooks as follows:
Define the RSA keys
If you don’t have keys that you want to use yet, generate them using these commands:
openssl genrsa -out oidc.key 4096
openssl rsa -in oidc.key -pubout -out public.key

And make them available to the plugin as follows (this needs to be added before WordPress loads):
define( 'OIDC_PUBLIC_KEY', << array(
'name' => 'The name of the Client',
'secret' => 'a secret string',
'redirect_uri' => 'https://example.com/redirect.uri',
'grant_types' => array( 'authorization_code' ),
'scope' => 'openid profile',
),
);
}

Exclude URL from caching

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.

Github Repo
You can report any issues you encounter directly on Github repo: Automattic/wp-openid-connect-server

延伸相關外掛

文章
Filter
Mastodon