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 Authorization Services based authz prototype #24

Merged
merged 20 commits into from
Jan 28, 2020

Conversation

mstruk
Copy link
Contributor

@mstruk mstruk commented Jan 10, 2020

Signed-off-by: Marko Strukelj [email protected]

This PR introduces authorization support that works hand-in-hand with OAuth2 authentication.

There is an example that allows a step-by-step walkthrough. See README-authz.md

The configuration is explained in JavaDoc of KeycloakRBACAuthorizer class

What's still missing are automated tests in the testsuite.

Copy link
Member

@tombentley tombentley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big piece of work, so this is just an initial pass, I'll look again next week.

Thanks!

Copy link
Member

@tombentley tombentley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proof read the README.

examples/README-authz.md Outdated Show resolved Hide resolved
examples/README-authz.md Outdated Show resolved Hide resolved
examples/README-authz.md Outdated Show resolved Hide resolved
examples/README-authz.md Show resolved Hide resolved
examples/README-authz.md Outdated Show resolved Hide resolved
examples/README-authz.md Outdated Show resolved Hide resolved
examples/docker/kafka-oauth-strimzi/compose-authz.yml Outdated Show resolved Hide resolved
examples/docker/kafka-oauth-strimzi/kafka/jwt.sh Outdated Show resolved Hide resolved
examples/docker/kafka-oauth-strimzi/kafka/oauth.sh Outdated Show resolved Hide resolved
Copy link
Member

@ppatierno ppatierno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a first quick pass leaving a few comments.

examples/README-authz.md Show resolved Hide resolved
In this case the access token represents the specific user, rather than the client application.

Before continuing, there is one setting we need to check.
Due to [a little bug in Keycloak](https://issues.redhat.com/browse/KEYCLOAK-12640) the realm is at this point misconfigured, and we have to fix the configuration manually.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should track this bug maybe with an issue here, in order to remember to remove this section when the Keycloak bug will be fixed and the workaround not needed anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ppatierno What is the standard practice for tracking external issues 'here'? Creating a new Issue and linking to external one in its description, then just leaving it open and occasionally checking it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mstruk yes, it's the only way I know :-/

examples/README-authz.md Outdated Show resolved Hide resolved
usage() {
echo "Usage: $0 [USERNAME] [PASSWORD] [ARGUMENTS] ..."
echo
echo "$0 is a tool for obtaining an access token or a refresh token for the user or the client."
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would maybe make sense to include oauth.sh, and jwt.sh in kafka image?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it would. IIRC we include the jar using the 3rd party jars mechanism, but we don't really have similar mechanism for including tools or scripts.

examples/README-authz.md Show resolved Hide resolved
examples/README-authz.md Outdated Show resolved Hide resolved
examples/README-authz.md Outdated Show resolved Hide resolved
usage() {
echo "Usage: $0 [USERNAME] [PASSWORD] [ARGUMENTS] ..."
echo
echo "$0 is a tool for obtaining an access token or a refresh token for the user or the client."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it would. IIRC we include the jar using the 3rd party jars mechanism, but we don't really have similar mechanism for including tools or scripts.

examples/docker/kafka-oauth-strimzi/kafka/oauth.sh Outdated Show resolved Hide resolved
@ppatierno ppatierno changed the title [WIP] Keycloak Authorization Services based authz prototype Keycloak Authorization Services based authz prototype Jan 24, 2020
@mstruk
Copy link
Contributor Author

mstruk commented Jan 26, 2020

I have some more fixes coming, for issues identified while testing with mutual TLS listeners and Kafka 2.4 ...

examples/README-authz.md Outdated Show resolved Hide resolved
@@ -0,0 +1,37 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please explain why do we need this file here? How is it used and how is it packaged?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently all the documentation is in examples/docker/README-authz.md which is a walkthrough example. This file is mentioned there. I can add a paragraph that explains how to import it into empty Authorization Services configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


public class AuthzConfig extends Config {

public static final String STRIMZI_AUTHZ_CLIENT_ID = "strimzi.authz.client.id";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should use authorization intead of authz. Lot of people does not know / use this as shortcut and might be confused.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@mstruk
Copy link
Contributor Author

mstruk commented Jan 27, 2020

It looks like the tests could use a longer timeout to give enough time to pull down images from docker hub.

@scholzj scholzj merged commit 8d4def3 into strimzi:master Jan 28, 2020
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

Successfully merging this pull request may close these issues.

4 participants