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

Refresh user claim #338

Merged
merged 2 commits into from
Mar 4, 2022
Merged

Refresh user claim #338

merged 2 commits into from
Mar 4, 2022

Conversation

rkcreation
Copy link
Contributor

@rkcreation rkcreation commented Sep 9, 2021

Fix #339
Address #122

All Submissions:

Changes proposed in this Pull Request:

Adding a new WP action to trigger user claim refresh.

How to test the changes in this Pull Request:

  1. Updates manually some attributes of your user
  2. Checks that $user->get('openid-connect-generic-last-user-claim') contains outdated information
  3. Calls
$user = wp_get_current_user();
$token_response = $user->get('openid-connect-generic-last-token-response');
do_action( 'openid-connect-generic-refresh-user-claim', $user, $token_response );
  1. Checks that $user->get('openid-connect-generic-last-user-claim') contains updated information

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Changelog entry

Adding a new WP action to trigger user claim refresh: do_action( 'openid-connect-generic-refresh-user-claim', $user, $token_response )

@rkcreation rkcreation mentioned this pull request Nov 22, 2021
6 tasks
@timnolte timnolte self-assigned this Dec 29, 2021
@timnolte timnolte added enhancement Issues & PRs related to new features. status: needs review PR that needs review. labels Feb 25, 2022
@timnolte timnolte added this to the 3.9.0 milestone Feb 25, 2022
@timnolte timnolte added this to To do in 3.9.0 Release Feb 25, 2022
3.9.0 Release automation moved this from To do to In progress Mar 4, 2022
@timnolte timnolte added status: approved PRs that have been approved and ready to be merged. and removed status: needs review PR that needs review. labels Mar 4, 2022
@timnolte timnolte merged commit 59f9818 into oidc-wp:dev Mar 4, 2022
3.9.0 Release automation moved this from In progress to Done Mar 4, 2022
@timnolte
Copy link
Collaborator

@rkcreation this is the feature I was meaning to comment on. ;-)

...just a heads up that I'm going to change this implementation a bit since there is now, with the release, a plugin singleton available that you can use to access some methods of the plugin directly. I'm going to change the new method so that it is available through this method as well as change the add_action to a do_action. This will allow you to either use the method that was added in your own add_action that the plugin will trigger, or you can just use the new method in any hook you would like, include any others provided by this plugin that make sense. Let me know if you have any concerns with that change.

@timnolte
Copy link
Collaborator

@rkcreation so after my refactor using the new singleton pattern you'll be able to do is this:

$user = wp_get_current_user();
$token_response = $user->get('openid-connect-generic-last-token-response');
oidcg_refresh_user_claim( $user, $token_response );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues & PRs related to new features. status: approved PRs that have been approved and ready to be merged.
Projects
No open projects
3.9.0 Release
  
Done
Development

Successfully merging this pull request may close these issues.

Method to refresh user claim
2 participants