| 开发者 | jfwenisch |
|---|---|
| 更新时间 | 2026年11月20日 23:31 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1.5 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
/wenisch-tech/keystone-oidc/.well-known/openid-configuration) for automatic client configurationopenid, profile, emailroles scope adds a roles claim with the user's WordPress roles to the ID token and UserInfo response/wenisch-tech/keystone-oidc/.well-known/openid-configuration/wenisch-tech/keystone-oidc/oauth/authorize/wenisch-tech/keystone-oidc/oauth/token/wenisch-tech/keystone-oidc/oauth/userinfo/wenisch-tech/keystone-oidc/oauth/jwks/wenisch-tech/keystone-oidc/protocol/openid-connect/* for clients that still derive Keycloak-style paths from the custom issuer URI. These aliases are not advertised in discovery.
UserInfo Example
For openid profile email, /wenisch-tech/keystone-oidc/oauth/userinfo returns:
{
"sub": "42",
"name": "Jane Doe",
"given_name": "Jane",
"family_name": "Doe",
"preferred_username": "jane",
"email": "jane@example.com",
"email_verified": true
}
sub is the WordPress user ID as a string, preferred_username is the WordPress user_login, and email is the WordPress user_email.
With the roles scope, the response also contains a flat roles array of WordPress role slugs:
"roles": ["editor"]
The roles scope is opt-in: tick it in the client's Allowed Scopes and request it from your application (for example scope=openid profile email roles). Capabilities are not exposed, and WordPress has no native groups, so no groups claim is sent.
keystone-oidc folder to /wp-content/plugins/keystone-oidc.zip from the GitHub Releases page and upload it via Plugins → Add New → Upload Plugin.Authorization Code Flow (confidential clients authenticate with their secret, public clients use PKCE). This is the most secure flow and suitable for all application types.
Client secrets are hashed using WordPress's password hashing (bcrypt). The plaintext secret is shown only once upon creation or reset and is never stored in the database.
Yes. Enable the roles scope for the client and request it. The user's WordPress roles (such as administrator or editor) are sent as a roles array in the ID token and UserInfo response. Developers can change the list with the keystone_oidc_user_roles filter.
Yes – you can create as many OIDC clients as you need from the admin panel.
All previously issued tokens will immediately become invalid. Use the Settings page to rotate keys when needed (e.g., after a security incident).
Yes, both S256 and plain code challenge methods are supported. Public clients (no secret) must use S256. Confidential clients must always authenticate with their client secret at the token endpoint.
A confidential client is a server-side application that can keep a secret. A public client (single-page or mobile app) cannot, so it uses PKCE instead. Set the type per client under OIDC Provider > Clients. Existing clients are treated as confidential after an update.
Yes. Register a public client and use either an https redirect (Android App Links / iOS Universal Links) or a reverse-domain private-use scheme such as com.example.app:/oauth2redirect (RFC 8252). PKCE with S256 is mandatory for public clients.
Yes. Keystone OIDC provides filters to allow or deny sign-in (keystone_oidc_authorize_user), re-check users on refresh (keystone_oidc_refresh_allowed), add custom claims to the ID token, access token and UserInfo response, and change token lifetimes. KEYSTONE_OIDC_Token_Manager::revoke_user_tokens() revokes a user's tokens, which also happens automatically when a user is deleted or changes their password. See the "Extending with hooks" page in the documentation.