[WordPress] 外掛分享: OpenID Connect Server

前言介紹

  • 這款 WordPress 外掛「OpenID Connect Server」是 2022-10-30 上架。
  • 目前有 60 個安裝啟用數。
  • 上一次更新是 2025-04-17,距離現在已有 17 天。
  • 外掛最低要求 WordPress 6.0 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 7.4 以上。
  • 尚未有人給過這款外掛評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

akirk | ashfame | psrpinto | wordpressdotorg |

外掛標籤

oidc | oauth | OpenID | oauth server | openid connect |

內容簡介

使用此外掛,您可以使用自己的 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', << -----BEGIN RSA PUBLIC KEY-----
...
-----END RSA PUBLIC KEY-----
OIDC_PUBLIC_KEY
);

define( '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 上報告您遇到的任何問題。

原文外掛簡介

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

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「OpenID Connect Server」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0 | 1.1.0 | 1.1.1 | 1.2.1 | 1.3.0 | 1.3.1 | 1.3.2 | 1.3.3 | 1.3.4 | 2.0.0 | trunk |

延伸相關外掛(你可能也想知道)

文章
Filter
Apply Filters
Mastodon