forked from conduktor/kafka-security-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6bde564
commit 0baa827
Showing
10 changed files
with
157 additions
and
37 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
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
25 changes: 25 additions & 0 deletions
25
src/main/scala/com/github/simplesteph/ksm/ExtractAcl.scala
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,25 @@ | ||
package com.github.simplesteph.ksm | ||
|
||
import com.github.simplesteph.ksm.parser.AclParser | ||
import kafka.security.auth.{ Acl, Authorizer, Resource } | ||
import org.slf4j.{ Logger, LoggerFactory } | ||
|
||
class ExtractAcl( | ||
authorizer: Authorizer, | ||
aclParser: AclParser) { | ||
|
||
val log: Logger = LoggerFactory.getLogger(classOf[ExtractAcl].getSimpleName) | ||
|
||
def extract(): Unit = { | ||
log.info("Running ACL Extraction mode") | ||
log.info("Getting ACLs from Kafka") | ||
val kafkaAcls = authorizer.getAcls() | ||
log.info("Closing Authorizer") | ||
authorizer.close() | ||
val acls: Set[(Resource, Acl)] = AclSynchronizer.flattenKafkaAcls(kafkaAcls) | ||
val extracted = aclParser.formatAcls(acls.toList) | ||
log.info("================ CURRENT ACLS ===============") | ||
println(extracted) | ||
} | ||
|
||
} |
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
14 changes: 14 additions & 0 deletions
14
src/main/scala/com/github/simplesteph/ksm/parser/AclParser.scala
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,14 @@ | ||
package com.github.simplesteph.ksm.parser | ||
|
||
import java.io.Reader | ||
|
||
import com.github.simplesteph.ksm.source.SourceAclResult | ||
import kafka.security.auth.{ Acl, Resource } | ||
|
||
trait AclParser { | ||
|
||
def aclsFromReader(reader: Reader): SourceAclResult | ||
|
||
def formatAcls(acls: List[(Resource, Acl)]): String | ||
|
||
} |
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
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