Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing user data fields between Wordpress and OIDC server (Keycloak) #122

Open
binaryfire opened this issue Apr 27, 2019 · 4 comments
Open
Labels
documentation Issues related to documentation changes or fixes.

Comments

@binaryfire
Copy link

Hi, just wondering if there's any way to sync user data (custom fields) between Wordpress and Keycloak? If so, could someone point me in the right direction? Thanks!

@bevinhex
Copy link

From keycloak to wordpress can be done via hooks, for revese, I'm researching as well

@alerque
Copy link

alerque commented May 27, 2021

@bevinhex Is there documentation on how to do that with hooks?

@daggerhart
Copy link
Collaborator

@alerque I don't think there is documentation atm, but I could write up something simple. Currently working on another plugin that will provide a UI for this, but it's probably a few weeks out.

here is a very rough draft to get you started

<?php


add_action( 'openid-connect-generic-user-logged-in', 'my_oidc_user_login' );

function my_oidc_user_login( \WP_User $user ) {
	// Everything we know about the user from the IDP.
	$id_token_claim = get_user_meta( $user->ID, 'openid-connect-generic-last-id-token-claim', true );
	$subject_identity = get_user_meta( $user->ID, 'openid-connect-generic-subject-identity', true );
	$user_claim = get_user_meta( $user->ID, 'openid-connect-generic-last-user-claim', true );
	$token_response = get_user_meta( $user->ID, 'openid-connect-generic-last-token-response', true );

	// Do something w/ it here...
}

@daggerhart daggerhart added the documentation Issues related to documentation changes or fixes. label May 27, 2021
This was referenced Sep 9, 2021
@jmayermsi
Copy link

Hello @daggerhart Sent you an email from your contact form. Just checking to see if you received it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issues related to documentation changes or fixes.
Projects
None yet
Development

No branches or pull requests

5 participants