-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cure HTTP Authentication Singleton's Password Overwrite (#19)
* Enable Service Provider Relocation (#17) (#4) Schema Registry Client's basic HTTP Authentication support is implemented through a ServiceProvider. Without handling the fact that relocating the schema client also relocates the service implementations, no implementations are found when the client attempts to find a strategy that matches an authentication source type specified through basic.auth.credentials.source... * Improve test cases that distinguish between source and destination credentials -- Split credentials fixture value pair into two distinct value pairs, one for source registry clients, another for destinations. -- Add test case verifying source authentication properties reach source registry client -- Add test case verifying destination authentication properties reach destination registry client -- Add test cases verifying expected exception when incorrect credentials are passed to source and/or destination registry client. -- Add test case using distinct credentials for both source and destination in same execution and using same authentication source strategy (currently does not pass!) * Compensate for Basic HTTP Authentication's Singleton Implementation The fact that Basic HTTP Authentication as implemented in the Kafka Connect Client uses a singleton to hold configured credentials means that if both the source and destination schema registries require basic HTTP authentication and want to provide credentials via `basic.auth.credentials.source`, the second set of credentials will overwrite and replace the first` Connect's three singletons for Basic HTTP Authentication are selected by the same three key values used in `basic.auth.credentials.source` to designate which represented algorithm to use. This commit begins compensating for these singletons first by creating and registering two additional copies of the Basic Auth singletons in the SMT's code base. One is intended for use by the source broker's schema registry client, the other is for destinaation broker's registry. The only intentional difference between what is built here and the production Kafka Connect namespac is the addition of a short prefix to distinguish `SRC_` from `DEST_`. Now, when removing a prefix it uses to broker input to one adapter or the orther, in addition to selecting which configuration hash destrination to use, it also adds that prefix to the value it provides for `basic.auth.credentials.source`. As a result, the source and destination schema registry clients will each now use a diffent singleton to hold onto their credentials with two distinct singletons. This work relies on addition of ServicesRouterTransformer to he maven shade plugin that was recently reviewd and released.
- Loading branch information
1 parent
8b76edb
commit cf5d375
Showing
11 changed files
with
120 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/cricket/jmoore/security/basicauth/DestSaslBasicAuthCredentialProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* Licensed under Apache-2.0 */ | ||
package cricket.jmoore.security.basicauth; | ||
|
||
import io.confluent.kafka.schemaregistry.client.security.basicauth.SaslBasicAuthCredentialProvider; | ||
|
||
public class DestSaslBasicAuthCredentialProvider extends SaslBasicAuthCredentialProvider { | ||
@Override | ||
public String alias() { | ||
return "DEST_SASL_INHERIT"; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/cricket/jmoore/security/basicauth/DestUrlBasicAuthCredentialProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* Licensed under Apache-2.0 */ | ||
package cricket.jmoore.security.basicauth; | ||
|
||
import io.confluent.kafka.schemaregistry.client.security.basicauth.UrlBasicAuthCredentialProvider; | ||
|
||
public class DestUrlBasicAuthCredentialProvider extends UrlBasicAuthCredentialProvider { | ||
@Override | ||
public String alias() { | ||
return "DEST_URL"; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/cricket/jmoore/security/basicauth/DestUserInfoCredentialProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* Licensed under Apache-2.0 */ | ||
package cricket.jmoore.security.basicauth; | ||
|
||
import io.confluent.kafka.schemaregistry.client.security.basicauth.UserInfoCredentialProvider; | ||
|
||
public class DestUserInfoCredentialProvider extends UserInfoCredentialProvider | ||
{ | ||
@Override | ||
public String alias() { | ||
return "DEST_USER_INFO"; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/cricket/jmoore/security/basicauth/SrcSaslBasicAuthCredentialProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* Licensed under Apache-2.0 */ | ||
package cricket.jmoore.security.basicauth; | ||
|
||
import io.confluent.kafka.schemaregistry.client.security.basicauth.SaslBasicAuthCredentialProvider; | ||
|
||
public class SrcSaslBasicAuthCredentialProvider extends SaslBasicAuthCredentialProvider { | ||
@Override | ||
public String alias() { | ||
return "SRC_SASL_INHERIT"; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/cricket/jmoore/security/basicauth/SrcUrlBasicAuthCredentialProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* Licensed under Apache-2.0 */ | ||
package cricket.jmoore.security.basicauth; | ||
|
||
import io.confluent.kafka.schemaregistry.client.security.basicauth.UrlBasicAuthCredentialProvider; | ||
|
||
public class SrcUrlBasicAuthCredentialProvider extends UrlBasicAuthCredentialProvider { | ||
@Override | ||
public String alias() { | ||
return "SRC_URL"; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/cricket/jmoore/security/basicauth/SrcUserInfoCredentialProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* Licensed under Apache-2.0 */ | ||
package cricket.jmoore.security.basicauth; | ||
|
||
import io.confluent.kafka.schemaregistry.client.security.basicauth.UserInfoCredentialProvider; | ||
|
||
public class SrcUserInfoCredentialProvider extends UserInfoCredentialProvider | ||
{ | ||
@Override | ||
public String alias() { | ||
return "SRC_USER_INFO"; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...s/io.confluent.kafka.schemaregistry.client.security.basicauth.BasicAuthCredentialProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
cricket.jmoore.security.basicauth.DestSaslBasicAuthCredentialProvider | ||
cricket.jmoore.security.basicauth.DestUrlBasicAuthCredentialProvider | ||
cricket.jmoore.security.basicauth.DestUserInfoCredentialProvider | ||
cricket.jmoore.security.basicauth.SrcSaslBasicAuthCredentialProvider | ||
cricket.jmoore.security.basicauth.SrcUrlBasicAuthCredentialProvider | ||
cricket.jmoore.security.basicauth.SrcUserInfoCredentialProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters