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

Scram Config API in Admin Client [KIP-554] #4241

Merged
merged 14 commits into from
Jul 10, 2023
Merged

Conversation

mahajanadhitya
Copy link
Contributor

No description provided.

Copy link
Contributor

@milindl milindl left a comment

Choose a reason for hiding this comment

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

Reviewed all the non-example code.
Great work @mahajanadhitya!

/*
* librdkafka - Apache Kafka C library
*
* Copyright (c) 2020, Magnus Edenhill
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Change copyright notice :)

src/rdkafka.h Outdated
typedef enum rd_kafka_ScramMechanism_s {
UNKNOWN = 0,
SCRAM_SHA_256 = 1,
SCRAM_SHA_512 = 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename these to RD_KAFKA_SCRAM_MECHANISM_SHA_256 and same for 512, and add a enum value at the end of the enum, called RD_KAFKA_SCRAM_MECHANISM__CNT (for looping and marking the end, if required)

src/rdkafka.h Outdated
typedef enum rd_kafka_UserScramCredentialAlteration_type_s {
RD_KAFKA_USER_SCRAM_CREDENTIAL_ALTERATION_TYPE_UPSERT,
RD_KAFKA_USER_SCRAM_CREDENTIAL_ALTERATION_TYPE_DELETE,
RD_KAFKA_USER_SCRAM_CREDENTIAL_ALTERATION_TYPE_CNT
Copy link
Contributor

Choose a reason for hiding this comment

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

use RD_KAFKA_USER_SCRAM_CREDENTIAL_ALTERATION_TYPE__CNT

src/rdkafka.h Outdated

typedef struct rd_kafka_UserScramCredentialAlteration_s rd_kafka_UserScramCredentialAlteration_t;

RD_EXPORT
Copy link
Contributor

Choose a reason for hiding this comment

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

need comments for all the publicly exported functions.

src/rdkafka.h Outdated
RD_EXPORT
void rd_kafka_AlterUserScramCredentials(rd_kafka_t *rk,
rd_kafka_UserScramCredentialAlteration_t **alterations,
size_t num_alterations,
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at convention, call it alteration_cnt

src/rdkafka_admin.h Outdated Show resolved Hide resolved
src/rdkafka_op.h Outdated Show resolved Hide resolved
src/rdkafka.h Outdated
RD_EXPORT
void rd_kafka_DescribeUserScramCredentials(rd_kafka_t *rk,
char **users,
size_t num_users,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as alter, call it user_cnt

src/rdkafka.h Outdated Show resolved Hide resolved
src/rdkafka.h Outdated Show resolved Hide resolved
@emasab emasab changed the title Scram Config API in Admin Client Scram Config API in Admin Client [KIP-554] Jun 1, 2023
* Remove editor configuration file

* Remove example binary and add it to
other places where it's listed

* Change copyright for new files

* Remove new error code

* Doxygen documentation,
remove return values from admin
functions

* Make alteration type an
internal enum

* Make returned types constant,
always return from async functions through
the queue

* Use event functions for top level error

* Return arrays when the array
contains pointers.
Renamed rd_kafka_UserScramCredentialAlterationResultElement
to rd_kafka_AlterUserScramCredentials_result_response
following admin api conventions

* Test improvements and fix for memory leak

* Use byte array for salt and password,
create random salt if not provided,
move hmac so sasl isn't required,
allow multiple alterations for the same
user as in Java,
example taking parameters from command
line

* Remove fprintf from tests

* Correct asserts when configured without SSL

* Compact bytes implementation,
use compact bytes for serialization

* Style fix

* Fix CMake

* Value 0x20000 is used by IncrementalAlterConfigs

* Documentation order

* Documentation improvements

* Read compact bytes implementation

* Improve security, refactor validation

* Changelog and support table

* Api versions update

* Address some comments

* Fix when disabling ssl

* Style fix and
use rd_strcmp2
LICENCE auto fix

* Address comments
@milindl milindl self-requested a review July 6, 2023 11:26
@milindl
Copy link
Contributor

milindl commented Jul 6, 2023

Note: Please don't merge immediately after CI green, wait for bindings changes as well, as discussed with @emasab

@emasab emasab merged commit c23adb9 into master Jul 10, 2023
@emasab emasab deleted the feature/userscram-AdminClient branch July 10, 2023 18:04
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.

3 participants