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

Keycloak devservice without OIDC #38556

Closed
agreedSkiing opened this issue Feb 2, 2024 · 14 comments · Fixed by #44389
Closed

Keycloak devservice without OIDC #38556

agreedSkiing opened this issue Feb 2, 2024 · 14 comments · Fixed by #44389

Comments

@agreedSkiing
Copy link
Contributor

Description

Would it be possible to make the keycloak dev service universal between all the keycloak extensions, so that I don't need to include the oidc dependency just to disable it later?

The project I'm working with is only using the keycloak admin client and letting an oidc checker/application in-front of the application fix the ABAC/RBAC validation.

We or the team wants to use the keycloak devservice as our “innerloop” testing tool and then in the “outloop” (ci/cd pipeline) use a dedicated keycloak installation.

Implementation ideas

No response

Copy link

quarkus-bot bot commented Feb 2, 2024

/cc @geoand (devservices), @pedroigor (keycloak,oidc), @sberyozkin (keycloak,oidc), @stuartwdouglas (devservices)

@sberyozkin
Copy link
Member

sberyozkin commented Feb 2, 2024

Does adding the oidc extension in the test scope work ?

@agreedSkiing
Copy link
Contributor Author

agreedSkiing commented Feb 4, 2024 via email

@sberyozkin
Copy link
Member

@agreedSkiing

Think I wrote it in the first post🤔? Might not have done that, but by including OIDC dependency I do get the devserice, but why should I need to include the OIDC dependency when I will just turn it off in the end?

I've updated the comment when I first made it, as I forgot to mention the test scope, you use it for tests, so my question is, does it work when this dependency is in the test scope, if yes, then you don't have to exclude it

@agreedSkiing
Copy link
Contributor Author

agreedSkiing commented Feb 5, 2024 via email

@agreedSkiing
Copy link
Contributor Author

agreedSkiing commented Feb 5, 2024 via email

@sberyozkin
Copy link
Member

@agreedSkiing OIDC dev service, like any other dev service, offers 2 containers:

  • one container supports Dev UI experience, example, in case of OIDC, one can test endpoints protected by OIDC directly from the OIDC SPA - but you don't use quarkus-oidc in prod, so I believe it is of no interest in your case
  • another container supports run integration tests - which fits your requirement - is it not enough for your requirements ?

The other thing is that as @stuartwdouglas has clarified to me earlier is that none of the deployment-only dependencies actually make it into the prod code, so if you need OIDC Dev UI support too, you can add quarkus-oidc-deployment without the test scope as well and avoid excluding it.

@sberyozkin
Copy link
Member

@agreedSkiing Ignore my last point there please, doesn't apply unless an extension is built.

But I'd like to understand better what exactly is required from the OIDC devservice in your case. So far I think the test scope should be sufficient, please explain why it may not be the case.

May be you also need a DevUI level Keycloak Admin link to set Keycloak directly from Dev UI ?

Having some common templating support for a few OIDC and Keycloak client side extensions as well as for OIDC itself may make sense.

@agreedSkiing
Copy link
Contributor Author

agreedSkiing commented Feb 6, 2024 via email

@sberyozkin
Copy link
Member

@agreedSkiing I'm still not sure what is missing

For my use case, it would be enough with that a keycloak devservice spins u, imports my realm if there is one or creates one base on the admin clients realm config

That should already work in the test scope for running tests

and assigns the keycloak url to the admin clients connections.

Each component has its own namespaces, and Dev service creates a common keycloak.url property, it is not exactly assigning it to a Keycloak Admin Client specific property but it only requires a single test profile level property to get it assigned correctly given keycloak.url is available.

I believe, from what I've read so far in your comments, that the use case is covered.

However, making sure a Dev UI Keycloak Admin link is available for keycloak-admin-client, oidc-client-*,possibly oidc-token-propagation, appears to be useful.

Might also be nice to have depending on the authentication to keycloak that it creates a user/client with the correct credentials.

Can you please clarify what do you mean ?

@agreedSkiing
Copy link
Contributor Author

agreedSkiing commented Feb 6, 2024 via email

@sberyozkin
Copy link
Member

@agreedSkiing I was saying that the devservice supports launching 2 containers, one to support the dev mode experience (in case of OIDC - to support the Dev UI OIDC SPA where users can login to Keycloak, and test the OIDC protected endpoint with the acquired tokens), another one for running the integration tests - which is what is required for an extension like quarkus-keycloak-admin and given that you have confirmed adding the quarkus-oidc in the test scope works for you, I'm still not sure what is the scope of this enhancement request.

I'm positive in general about improving the dev service support for Keycloak centric and more general OIDC client extensions but like I said, it looks like your requirement is already met, minus that you do not have a Keycloak admin client address property auto-assigned.

Perhaps we can consider a new common extension which launches containers only and only sets a shared keycloak.url property and other extensions continue with preparing extension specific properties, UI, etc... I think it makes sense so I'll keep this enhancement request open - it may take a little while to resolve, for now please use the test scoped quarkus-oidc depedency for running the tests

@sberyozkin sberyozkin self-assigned this Feb 6, 2024
@agreedSkiing
Copy link
Contributor Author

agreedSkiing commented Feb 6, 2024 via email

@lebesis
Copy link

lebesis commented Sep 2, 2024

Hello.

I am developing a microservice, which will act as a bridge between two systems with different authentication/authorization mechanisms.
Therefore I have to use a different library for incoming request authorization and quarkus-rest-client-oidc-filter for outgoing requests.

My issue is that I cannot use keycloak dev service without enabling quarkus-oidc in the default scope.

I have tried using quarkus.oidc.enabled=false and it does work if you start the application with this setting commented out and then hot reload by uncommenting it. But this is a workaround I'd rather not use.
I 've tried using this setting in conjunction with quarkus.keycloak.devservices.enabled=true, but still no dice.

It would be nice if the dev services could be started by quarkus-oidc-client without including quarkus-oidc

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

Successfully merging a pull request may close this issue.

3 participants