-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
PIP-30: interface and mutual change authentication #3677
Conversation
@eolivelli would you please also help look at this. Thanks. |
Sure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work.
I left a couple of suggestions
...r-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationDataSource.java
Outdated
Show resolved
Hide resolved
...broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationState.java
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
pulsar-common/src/main/java/org/apache/pulsar/common/api/Commands.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks good. left a few comments around the interface. I think there are still improvements to make the interface cleaner.
...broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationState.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will take another look tomorrow.
What about the http API ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general. Requested a few changes.
...broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationState.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
run integration tests |
@eolivelli @ivankelly updated, Would you please help review again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are close to be ready.
I left a couple of comments.
...r-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationDataSource.java
Outdated
Show resolved
Hide resolved
...oker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationService.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Show resolved
Hide resolved
pulsar-client-api/src/main/java/org/apache/pulsar/common/api/AuthData.java
Outdated
Show resolved
Hide resolved
@eolivelli Thanks for the comments, updated again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't reviewed fully, but one thing I saw quickly was that the challenge goes from the client to the broker. It should be the other way around. The client initiates the connection, the server challenges the client and the client responds to the server's challenge.
@ivankelly Thanks, updated. |
run java8 tests |
@jiazhai added @jerrypeng as he's been making some other auth changes lately. |
...ker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProvider.java
Outdated
Show resolved
Hide resolved
...oker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationService.java
Outdated
Show resolved
Hide resolved
...broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationState.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
...broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationState.java
Show resolved
Hide resolved
...ommon/src/main/java/org/apache/pulsar/broker/authentication/OneStageAuthenticationState.java
Outdated
Show resolved
Hide resolved
pulsar-common/src/main/java/org/apache/pulsar/common/api/Commands.java
Outdated
Show resolved
Hide resolved
pulsar-common/src/main/java/org/apache/pulsar/common/api/Commands.java
Outdated
Show resolved
Hide resolved
pulsar-common/src/main/java/org/apache/pulsar/common/api/Commands.java
Outdated
Show resolved
Hide resolved
Thanks @ivankelly , updated it again. |
run java8 tests |
run java8 tests for error: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is missing unit tests. It should be fairly easy to mock up a AuthProvider to do multi stage auth.
private void doingAuthentication(AuthData clientData, | ||
int clientProtocolVersion, | ||
String clientVersion) throws Exception { | ||
AuthData brokerData = authState.authenticate(clientData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, what I find strange is that we make a call to mutate authState, and then immediately query authState to see what that mutation resulted in. It feels like this would be better done in a single call, especially if multiple threads come into play at a later date.
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
pulsar-common/src/main/java/org/apache/pulsar/common/api/Commands.java
Outdated
Show resolved
Hide resolved
@ivankelly updated again. would you please help review it again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the client side, where does it get the initial data to sent in the ConnectCommand?
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ServerCnxTest.java
Outdated
Show resolved
Hide resolved
...ker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProvider.java
Outdated
Show resolved
Hide resolved
...ommon/src/main/java/org/apache/pulsar/broker/authentication/OneStageAuthenticationState.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/client/api/MutualAuthenticationTest.java
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/client/api/MutualAuthenticationTest.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/client/api/MutualAuthenticationTest.java
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/client/api/MutualAuthenticationTest.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/client/api/MutualAuthenticationTest.java
Outdated
Show resolved
Hide resolved
@ivankelly Thanks for the comments. update it again. |
rerun java8 tests |
1 similar comment
rerun java8 tests |
@ivankelly @eolivelli can you guys please review this again? we have to push this forward to unblock subsequent changes. |
...ker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProvider.java
Outdated
Show resolved
Hide resolved
...ker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProvider.java
Outdated
Show resolved
Hide resolved
...broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationState.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Show resolved
Hide resolved
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/client/api/MutualAuthenticationTest.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/client/api/MutualAuthenticationTest.java
Outdated
Show resolved
Hide resolved
@ivankelly Thanks for the comments, updated |
run integration tests
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small comment. Otherwise it's ready to go.
pulsar-client-api/src/main/java/org/apache/pulsar/common/api/AuthData.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. good work Jia!
Fixes #3652 **Motivation** Currently both Zookeeper and BookKeeper could be secured by using Kerberos, It would be good to support Kerberos in Pulsar Broker and Client. This is the sub-task for issue in #3491 to support Kerberos in Pulsar Broker and Client. Will add proxy and web resource support in following prs. The Kerberos authentication is similar to that in Zookeeper and BookKeeper, which leverage SASL and GSSAPI, so reused some of the code there. PR #3658 is the first version of PR before #3677 . **Changes** provide both client and broker side support for authentication api; add unit test.
Motivation
This is to implement the mutual auth api discussed in PIP-30: change authentication provider API to support mutual authentication
Modifications
Describe the modifications you've done.
Verifying this change