Skip to content

Commit

Permalink
Fix tests after removal of ApplAccounts
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Schmetzer committed Oct 22, 2020
1 parent 0e59390 commit aebf3b8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 36 deletions.
9 changes: 3 additions & 6 deletions src/main/kotlin/com/instaclustr/kafka/ldap/LDAPConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ object LDAPConfig {

// A couple of extension functions for Config
fun LDAPConfig.Config.toUserDN(user: String) = "$usrUid=$user,$usrBaseDN".toLowerCase()
fun LDAPConfig.Config.toUserDNNodes(user: String) =
// assuming most use of Basta generated service accounts
listOf(
"$usrUid=$user,$usrBaseDN".toLowerCase(),
"$usrUid=$user,$usrBaseDN".toLowerCase()
)

// TODO: remove this method, no longer support applaccounts JFS 2010-10-22
fun LDAPConfig.Config.toUserDNNodes(user: String) = listOf("$usrUid=$user,$usrBaseDN".toLowerCase())
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ object LDAPAuthenticationSpec : Spek({
val refUsers = mapOf(
Pair("srvp01", "srvp01") to true,
Pair("srvc01", "srvc01") to true,
Pair("srvp02", "srvp02") to true,
Pair("srvc02", "srvc02") to true,
Pair("srvp01", "invalidpwd") to false,
Pair("srvp02", "invalidpwd") to false,
Pair("invalid", "srvc01") to false
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ object SimpleLDAPAuthenticationSpec : Spek({
arrayOf(
NameCallback("correct user and pwd", "srvp01"),
PlainAuthenticateCallback("srvp01".toCharArray())
) to true,
arrayOf(
NameCallback("correct user and pwd", "srvp02"),
PlainAuthenticateCallback("srvp02".toCharArray())
) to true
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,38 +69,24 @@ object GroupAuthorizerSpec : Spek({
val refUserDescribeACL = mapOf(
Triple("srvp01", listOf("KC-tpc-01", "KP-tpc-01"), "tpc-01") to false,
Triple("srvc01", listOf("KC-tpc-01", "KP-tpc-01"), "tpc-01") to false,
Triple("srvp02", listOf("KC-tpc-01", "KP-tpc-01"), "tpc-01") to false,
Triple("srvc02", listOf("KC-tpc-01", "KP-tpc-01"), "tpc-01") to false,

Triple("srvp01", listOf("KC-tpc-02", "KP-tpc-02"), "tpc-02") to true,
Triple("srvc01", listOf("KC-tpc-02", "KP-tpc-02"), "tpc-02") to false,
Triple("srvp02", listOf("KC-tpc-02", "KP-tpc-02"), "tpc-02") to false,
Triple("srvc02", listOf("KC-tpc-02", "KP-tpc-02"), "tpc-02") to true,

Triple("srvp01", listOf("KC-tpc-03", "KP-tpc-03"), "tpc-03") to false,
Triple("srvc01", listOf("KC-tpc-03", "KP-tpc-03"), "tpc-03") to true,
Triple("srvp02", listOf("KC-tpc-03", "KP-tpc-03"), "tpc-03") to true,
Triple("srvc02", listOf("KC-tpc-03", "KP-tpc-03"), "tpc-03") to false
Triple("srvc01", listOf("KC-tpc-03", "KP-tpc-03"), "tpc-03") to true
)

val refUserWriteACL = mapOf(
Triple("srvp01", "KP-tpc-01", "tpc-01") to false,
Triple("srvp01", "KP-tpc-02", "tpc-02") to true,
Triple("srvp01", "KP-tpc-03", "tpc-03") to false,

Triple("srvp02", "KP-tpc-01", "tpc-01") to false,
Triple("srvp02", "KP-tpc-02", "tpc-02") to false,
Triple("srvp02", "KP-tpc-03", "tpc-03") to true
Triple("srvp01", "KP-tpc-03", "tpc-03") to false
)

val refUserReadACL = mapOf(
Triple("srvc01", "KC-tpc-01", "tpc-01") to false,
Triple("srvc01", "KC-tpc-02", "tpc-02") to false,
Triple("srvc01", "KC-tpc-03", "tpc-03") to true,

Triple("srvc02", "KC-tpc-01", "tpc-01") to false,
Triple("srvc02", "KC-tpc-02", "tpc-02") to true,
Triple("srvc02", "KC-tpc-03", "tpc-03") to false
Triple("srvc01", "KC-tpc-03", "tpc-03") to true
)

context("describe allowance") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,8 @@ object LDAPAuthorizationSpec : Spek({

val refUserGroup = mapOf(
Pair("srvc01", listOf("rmy-01")) to 1,
Pair("srvc02", listOf("rmy-02")) to 1,
Pair("srvp01", listOf("rmy-01", "rmy-02")) to 1,
Pair("srvp02", listOf("rmy-02", "rmy-01")) to 0,
Pair("srvp01", listOf("KC-tpc-02", "KP-tpc-02")) to 1,
Pair("srvc02", listOf("KC-tpc-02", "rmy-02")) to 2,
Pair("srvp02", listOf("KC-tpc-02", "rmy-02", "KP-tpc-03")) to 1,
Pair("srvc02", listOf("KC-tpc-02", "rmy-02", "KP-tpc-03")) to 2
Pair("srvp01", listOf("KC-tpc-02", "KP-tpc-02")) to 1
)

context("correct path to default YAML config") {
Expand Down

0 comments on commit aebf3b8

Please sign in to comment.