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

Added Keycloak Authorization configuration #2432

Merged
merged 15 commits into from
Jan 30, 2020

Conversation

ppatierno
Copy link
Member

Signed-off-by: Paolo Patierno [email protected]

Type of change

  • Enhancement / new feature

Description

This PR fixes #2428.
It's still missing tests and including the kafka-oauth-keycloak-authorizer JAR coming from this other PR strimzi/strimzi-kafka-oauth#24 still in progress.

Checklist

Please go through this checklist and make sure all applicable tasks have been done

  • Update/write design documentation in ./design
  • Write tests
  • Make sure all tests pass
  • Update documentation
  • Check RBAC rights for Kubernetes / OpenShift roles
  • Try your changes from Pod inside your Kubernetes and OpenShift cluster, not just locally
  • Reference relevant issue(s) and close them after merging
  • Update CHANGELOG.md

@ppatierno ppatierno requested review from mstruk and scholzj January 20, 2020 21:28
@ppatierno ppatierno added this to the 0.17.0 milestone Jan 20, 2020
@ppatierno
Copy link
Member Author

@scholzj @mstruk even if WIP, a first review would be really appreciated to have it ready as soon as possible for the next 0.17.0 release.

* @param superUsers Super users list who have all the rights on the cluster
* @param authorization The authorization configuration from the Kafka CR
*/
private void configureAuthorization(String clusterName, List<String> superUsers, KafkaAuthorization authorization) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we maybe split this into two methods? configureSimpleAuthorization and configureKeycloakAuthorization?

Copy link
Member Author

Choose a reason for hiding this comment

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

We already have a similar pattern for configuring authentication on which I agree. The configuraAuthentication method is just one and we have the logic for different authentication mechanisms inside. I am not sure about the advantage of having different methods here.

} else if (KafkaAuthorizationKeycloak.TYPE_KEYCLOAK.equals(authorization.getType())) {
KafkaAuthorizationKeycloak keycloakAuthz = (KafkaAuthorizationKeycloak) authorization;
writer.println("authorizer.class.name=" + KafkaAuthorizationKeycloak.AUTHORIZER_CLASS_NAME);
writer.println("principal.builder.class=" + KafkaAuthorizationKeycloak.PRINCIPAL_BUILDER_CLASS_NAME);
Copy link
Member

Choose a reason for hiding this comment

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

Can you double check what impact does this have on the internal super users? Do they still keey their own names?

Copy link
Contributor

Choose a reason for hiding this comment

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

They should keep their names, yes.

The JwtKafkaPrincipalBuilder only does something different when user was authenticated over SASL_OAUTHBEARER as seen here. An internal user would be handled by the same logic as before.

@ppatierno ppatierno changed the title WIP: Added Keycloak Authorization configuration Added Keycloak Authorization configuration Jan 24, 2020
@ppatierno
Copy link
Member Author

This is not WIP anymore but we don't have to merge until strimzi/strimzi-kafka-oauth#24 is merged. Anyway can you have another review pass @scholzj @mstruk please? 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.

Nits only. LGTM.

@ppatierno
Copy link
Member Author

@tombentley @scholzj @mstruk FYI I tried this with the keycloak library 0.3.0 (from the staging repository) and the integration seems to work fine.

@ppatierno
Copy link
Member Author

@strimzi-ci run tests

@strimzi-ci
Copy link

Build Failed

@ppatierno
Copy link
Member Author

@strimzi-ci run tests

@strimzi-ci
Copy link

❌ Test Summary ❌

TEST_PROFILE: acceptance
TEST_CASE: *ST
TOTAL: 20
PASS: 17
FAIL: 3
SKIP: 0

❗ Test Failures ❗

  • testLoadBalancerTls in io.strimzi.systemtest.KafkaST
  • testKafkaAndZookeeperScaleUpScaleDown in io.strimzi.systemtest.RollingUpdateST
  • testKafkaConnectWithFileSinkPlugin in io.strimzi.systemtest.ConnectST

Re-run command:
@strimzi-ci run tests profile=acceptance testcase=io.strimzi.systemtest.KafkaST#testLoadBalancerTls,io.strimzi.systemtest.RollingUpdateST#testKafkaAndZookeeperScaleUpScaleDown,io.strimzi.systemtest.ConnectST#testKafkaConnectWithFileSinkPlugin

Copy link
Member

@scholzj scholzj left a comment

Choose a reason for hiding this comment

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

Some nits, but LGTM otherwise.

@ppatierno ppatierno merged commit 4f533bf into strimzi:master Jan 30, 2020
@ppatierno ppatierno deleted the keycloak-authz branch January 30, 2020 17:28
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.

Integrate OAuth Authorization into Strimzi
5 participants