function hook_openid_connect_user_properties_ignore_alter in OpenID Connect / OAuth client 2.x
Same name and namespace in other branches
- 8 openid_connect.api.php \hook_openid_connect_user_properties_ignore_alter()
Alter the user properties to be ignored for mapping.
This hook is called before OpenID Connect maps the user information from the identity provider with the Drupal user account.
A popular use for this hook is to prevent properties from being mapped for certain identity providers.
Parameters
array $properties_to_skip: An array of of properties to skip.
array $context: An empty array for the OpenID Connect settings form, or an associative array with context information, if the hook is invoked during user authorization:
- tokens: An array of tokens.
- user_data: An array of user and session data from the ID token.
- userinfo: An array of user information from the userinfo endpoint.
- plugin_id: The plugin identifier.
- sub: The remote user identifier.
1 invocation of hook_openid_connect_user_properties_ignore_alter()
- OpenIDConnect::userPropertiesIgnore in src/
OpenIDConnect.php - Return user properties that can be ignored when mapping user profile info.
File
- ./
openid_connect.api.php, line 84 - Documentation for OpenID Connect module APIs.
Code
function hook_openid_connect_user_properties_ignore_alter(array &$properties_to_skip, array $context) {
// Allow to map the username to a property from the provider.
if ($context['plugin_id'] == 'generic') {
unset($properties_to_skip['name']);
}
}