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

Is it possible to retrive a App\Entity\User #33

Open
HiroKX opened this issue Aug 3, 2023 · 2 comments
Open

Is it possible to retrive a App\Entity\User #33

HiroKX opened this issue Aug 3, 2023 · 2 comments

Comments

@HiroKX
Copy link

HiroKX commented Aug 3, 2023

Hello,

I've successfully implemented the bundle, but I couldn't get any relations of my App\Entity\User. Is there a way to retrieve this?

I've tried with a UserProvider, but something doesn't work properly, I guess...

Thanks for your help.

@konandrum
Copy link
Member

Hello, difficult to understand well what you would like to do.
If you would like to bind a KeycloakUser with your local user (entity), you can do that by Overide the KeycloakUserProvider.

You can also use an Event listener to change the Session user.

Hope this will help you.

@zenobio93
Copy link

Hello @HiroKX,

For our usecase we needed to store / update the user getting by Keycloak into our database.

We have solved this by writing our own KeycloakUserProvider extending the KnpU\OAuth2ClientBundle\Security\User\OAuthUserProvider and implementing the IDCI\Bundle\KeycloakSecurityBundle\Security\User\KeycloakUserProviderInterface.

Then you can use it as provider:

security:
  providers:
    keycloak_security_provider:
      id: App\Core\Security\User\KeycloakUserProvider
      
  firewalls:
    main:
      pattern: ^/
      provider: keycloak_security_provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants