-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Improve security guides (or impl) for Quarkus users #2231
Comments
In addition, an example article/document where OAuth is used (with Twitter or Google) would be really helpful. And if I can stretch my luck... one with and without KeyCloak :) |
I agree that some consolidation must happen around these 3 guides but not an easy task. As you said, let's start to identify the common parts like :
Then we could make specific sections for
It is in the steps, looks at the section
Agreed
That can be hard to explain "when" because it really depends. But we could clearly explain the differences between these 3 options.
I don't think so, it's all based on the same annotation on the resources. The one exception with the But since it was not clear for you, we need to clarify that in the documentation.
+1
That also needs to be clarified : the In a lot of cases, you can just use the
Instead of showing |
The first thing I see in the guide is the fat configuration table (see https://quarkus.io/guides/jwt-guide) |
In a lot of cases, you can just use the jwt extension. The token can be issued by any idm server , like Keycloak server. You can take a look at my example here : https://github.com/sebastienblanc/quarkus-quickstart and I think @starksm64 is also writing a new quickstart showing this. I do understand that it's not the Keycloak nor the JWT extension core feature to generate a JWT token. |
Yeah maybe it should be at the end of the guide (or moved to a general |
I mean a Quarkus REST client talking to a secured service. |
Not necessarily the end but after the "getting started" proper.Like this for example https://quarkus.io/guides/hibernate-orm-guide |
Ah I see, and yes that would be great and with Quarkus it's so easy, in my example I'm using the rest client in combination with the So you have nothing to do beside calling your secured service. |
For 1. I think it's still relevant to have it. People might want to try out quickly the |
There is a request to enhance MP JWT API with the portable builder API to get the tokens self-issued/generated, can be useful for the tests. The only dilemma is whether to make that part of MP-JWT or of something independent. |
You mean being able to inject |
@sebastienblanc yes, exactly. But I'm not sure yet about the path in Quarkus, in Thorntail we bypass the actual KC adapter and use a light-weight smallrye-jwt KC factory. May be something similar can be done in Quarkus smallrye-jwt or as @pedroigor suggested, interposing JsonWebToken principal on top of the one prepared by the KC adapter will do the trick. I'm positive it can be done somehow :-) |
We should look at having the smallrye-jwt extension be able to perform the JsonWebToken and @claim injection whenever there is a MP-JWT compatible bearer token source. The keycloak extension should just enable this when the adaptor is configured with that type of bearer token. The thing that needs to be reconciled is the authenticated user account representation that the JsonWebToken and @claim injection is based on. I'll write up a design discussion doc and try to schedule a call on this issue next week. |
I agree with most of the items in that list, mainly those related with clarifications to documentation and the alignment between Keycloak extension and MP-JWT API/extension. I've looked I like the idea of mocking tokens and using them during tests. However, I'm not sure how this impacts coverage considering that you may have additional settings and capabilities involved when issuing and consuming these tokens. For instance, if your application relies on some social provider authentication, you won't be testing that. Or if you have specific settings in Keycloak that you want to cover when writing a test for a protected service. In addition to that, docker makes things easier so that you can easily write a fully functional and integrated test. Self-issued tokens may be nice for a demo, but not sure if this holds true for a real deployment. In regards to OIDC/OAuth and JWT, we should keep these concepts separated. Being the most common approach for token-based authorization, OAuth does not mention JWT. Neither JWT is related to OAuth. However, the OAuth-WG is working on a JWT profile for OAuth access tokens that maybe we could consider in the MP-JWT extension. The Keycloak extension is really targeted for deployments using Keycloak(for OIDC/OAuth), it should not be considered a general OIDC/OAuth/JWT implementation. But yeah, we could make it more MP-JWT compliant for sure ... |
Hey all, |
The other feedback is that people tried to set up OAuth with our doc and failed. |
I was able to get the "using-keycloak" set up fairly easy but I cannot for the life of my get one single endpoint to be @permitAll (anonymous). It seems I either need to disable enforcement (permissive does not work) or make every endpoint require login if any of them need login. Basic vanilla "using-keycloak" quickstart and using application.properties to configure Keycloak. In context: I've had great success working on the Keycloak core project as well as a 3rd party module for it so this shouldn't be such a difficult task to accomplish. Feeling like I've exhausted resources and don't know where to look next. I get that Quarkus is incredibly new so I am looking forward to better docs, better examples/quickstarts, better integration and more maturity because I am truly excited for Quarkus. |
Also see current proposal on OAuth2 (PR) #3078 |
@sberyozkin @pedroigor @sebastienblanc so what's the status of this? Should it be closed? Is there still some work required? If so, what? |
One still outstanding issue is that this tutorial says
This does seem to imply that anonymous access should work with the However, in practice, this doesn't seems to work for anonymous access
Another relevant issue regarding anonymous access is #6807 |
@stefnotch thanks for these links, but it is not a security doc bug, I'm not sure we need to start deleting the doc texts everytime an issue is open which points to some inconsistency with the docs and the actual quarkus behaviour :-). Let me close this issue then, it would be easier to keep talking about the specific issues in the dedicated issues like #6807 thanks |
I see this issue has been closed a few months ago... but have the issues raised actually been addressed so far? I am and or have been struggling with the issues described in this thread - lots of different tutorial resources on the topic, also I found @permitAll confusing, and it took me long to find a way to get enable a full unauthorized endpoint (for a stripe webhook) - since I have globally protected all endpoints on /api/ as described in one of those tutorials. Finally, I would love to see some examples on integration testing oauth2 secured endpoints. In Micronaut security I did not run into as much troubles, to be honest. |
Let's open dedicated issues to the problem you have experienced. We will be able to hunt them down more easily. PS that's also a reason why I prefer more concrete actionable titles for issues like that. Improve foo is a never ending task ;) |
Sure. Who. Where. How.
Am 29. Juni 2020, 13:56, um 13:56, Emmanuel Bernard <[email protected]> schrieb:
…Let's open dedicated issues to the problem you have experienced. We
will be able to hunt them down more easily. PS that's also a reason why
I prefer more concrete actionable titles for issues like that. Improve
foo is a never ending task ;)
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#2231 (comment)
|
On Mon 29 Jun 2020 at 23:31, Marcus Biel ***@***.***> wrote:
Sure. Who.
You :) you would be the best to capture the need.
Where.
quarkusio/Quarkus GitHub issue is where we capture everything.
How.
Add the area/security label and @mention Sergey and I.
|
I have been discussing with @stephanj about Quarkus and security recently.
He pointed me to the following blog post. He found the explanations and features great.
https://piotrminkowski.wordpress.com/2019/04/25/micronaut-tutorial-security/
We have likely all the features but maybe we don't explain them as nicely.
Today we have a general security guide https://quarkus.io/guides/security-guide Which is quite good I think albeit more technical than the blog. BTW, I could not figure out the reason for having a
@DenyAll
annotation on a resource.Then this guide mentions JWT independently from the JWT guide
https://quarkus.io/guides/jwt-guide we have.
Then we have the keycloak-guide which is not referenced by the JWT guide.
https://quarkus.io/guides/keycloak-guide
In the blog post, the person writes a client side test which If find brilliant as it helps for the extra mile of comprehension.
So for me there at the following possible actions, all are genuine questions we should discuss and execute one once agreed:
quarkus-security-extension
or everything underquarkus-security-*
quarkus.
with possible more advanced features under another namespace. This is roughly what we did with Hibernate ORM.The text was updated successfully, but these errors were encountered: