Skip to content

Commit

Permalink
Preauth anything that talks to the heroku-kafka API
Browse files Browse the repository at this point in the history
Due to the authentication mechanism we use, we need to be
pre-authenticated anytime we talk to the heroku-kafka API for anything
that requires 2FA. Because the first call we usually make is to the
Heroku API (to get app info about the cluster(s) we are interacting
with), requiring preauth on the commands works around this issue.

The exceptions here are the `topics:tail` and `topics:write` commands,
which talk to the cluster directly and not to the heroku-kafka API.
  • Loading branch information
Maciek Sakrejda committed Dec 8, 2016
1 parent 873d3ed commit d743d43
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion commands/configure.js
Expand Up @@ -62,5 +62,5 @@ module.exports = {
{ name: 'no-compaction', description: 'disables compaction on the topic if passed', hasValue: false },
{ name: 'replication-factor', description: 'number of replicas each partition in the topic has', hasValue: true }
],
run: cli.command(co.wrap(configureTopic))
run: cli.command({preauth: true}, co.wrap(configureTopic))
}
2 changes: 1 addition & 1 deletion commands/credentials_rotate.js
Expand Up @@ -41,5 +41,5 @@ module.exports = {
hasValue: false,
required: true }
],
run: cli.command(co.wrap(credentialsRotate))
run: cli.command({preauth: true}, co.wrap(credentialsRotate))
}
2 changes: 1 addition & 1 deletion commands/fail.js
Expand Up @@ -56,5 +56,5 @@ module.exports = {
hasValue: true,
required: false }
],
run: cli.command(co.wrap(fail))
run: cli.command({preauth: true}, co.wrap(fail))
}
2 changes: 1 addition & 1 deletion commands/jmx.js
Expand Up @@ -56,5 +56,5 @@ module.exports = {
`,
needsApp: true,
needsAuth: true,
run: cli.command(co.wrap(jmx))
run: cli.command({preauth: true}, co.wrap(jmx))
}
2 changes: 1 addition & 1 deletion commands/topics.js
Expand Up @@ -59,7 +59,7 @@ let cmd = {
],
needsApp: true,
needsAuth: true,
run: cli.command(co.wrap(listTopics))
run: cli.command({preauth: true}, co.wrap(listTopics))
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion commands/topics_compaction.js
Expand Up @@ -55,5 +55,5 @@ module.exports = {
{ name: 'VALUE' },
{ name: 'CLUSTER', optional: true }
],
run: cli.command(co.wrap(compaction))
run: cli.command({preauth: true}, co.wrap(compaction))
}
2 changes: 1 addition & 1 deletion commands/topics_create.js
Expand Up @@ -84,7 +84,7 @@ let cmd = {
description: 'pass the app name to skip the manual confirmation prompt',
hasValue: true }
],
run: cli.command(co.wrap(createTopic))
run: cli.command({preauth: true}, co.wrap(createTopic))
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion commands/topics_destroy.js
Expand Up @@ -53,7 +53,7 @@ let cmd = {
description: 'pass the app name to skip the manual confirmation prompt',
hasValue: true }
],
run: cli.command(co.wrap(destroyTopic))
run: cli.command({preauth: true}, co.wrap(destroyTopic))
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion commands/topics_info.js
Expand Up @@ -100,7 +100,7 @@ let cmd = {
`,
needsApp: true,
needsAuth: true,
run: cli.command(co.wrap(kafkaTopic))
run: cli.command({preauth: true}, co.wrap(kafkaTopic))
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion commands/topics_replication_factor.js
Expand Up @@ -49,5 +49,5 @@ module.exports = {
{ name: 'VALUE' },
{ name: 'CLUSTER', optional: true }
],
run: cli.command(co.wrap(replicationFactor))
run: cli.command({preauth: true}, co.wrap(replicationFactor))
}
2 changes: 1 addition & 1 deletion commands/topics_retention_time.js
Expand Up @@ -56,5 +56,5 @@ module.exports = {
{ name: 'VALUE' },
{ name: 'CLUSTER', optional: true }
],
run: cli.command(co.wrap(retentionTime))
run: cli.command({preauth: true}, co.wrap(retentionTime))
}
2 changes: 1 addition & 1 deletion commands/upgrade.js
Expand Up @@ -57,5 +57,5 @@ module.exports = {
{ name: 'version', description: 'requested kafka version for upgrade', hasValue: true, required: true },
{ name: 'confirm', description: 'pass the app name to skip the manual confirmation prompt', hasValue: true }
],
run: cli.command(co.wrap(upgradeCluster))
run: cli.command({preauth: true}, co.wrap(upgradeCluster))
}
2 changes: 1 addition & 1 deletion commands/zookeeper.js
Expand Up @@ -60,5 +60,5 @@ module.exports = {
`,
needsApp: true,
needsAuth: true,
run: cli.command(co.wrap(zookeeper))
run: cli.command({preauth: true}, co.wrap(zookeeper))
}

0 comments on commit d743d43

Please sign in to comment.