Skip to content

Commit

Permalink
fix auto login in client (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
strokyl authored Jul 12, 2024
1 parent 2e25c8f commit 3afb03a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func Make(apiParameter ApiParameter) (*Client, error) {
result.apiKey = jwtToken.AccessToken
}

if apiParameter.ApiKey != "" {
if result.apiKey != "" {
result.setApiKeyInRestClient()
} else {
//it will be set later only when really needed
Expand Down
20 changes: 19 additions & 1 deletion docker/initializer.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"httpResponse": {
"statusCode": 200,
"body": {
"access_token": "yo",
"access_token": "yo_from_login",
"refresh_token": "yo",
"token_type": "yo",
"expires_in": 0
Expand Down Expand Up @@ -194,5 +194,23 @@
"httpResponse": {
"statusCode": 200
}
},
{
"httpRequest": {
"method": "Get",
"path": "/public/console/v2/kafka-cluster/my_kafka_cluster",
"headers": {
"Authorization": "Bearer yo_from_login"
}
},
"httpResponse": {
"statusCode": 200,
"body": {"metadata": {"name": "a"}},
"headers": {
"Content-Type": [
"application/json"
]
}
}
}
]
1 change: 1 addition & 0 deletions test_final_exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ main() {
docker compose -f docker/docker-compose.yml run conduktor get Topic yolo --cluster=my-cluster
docker compose -f docker/docker-compose.yml run conduktor delete Topic yolo -v --cluster=my-cluster
docker compose -f docker/docker-compose.yml run -e CDK_USER=admin -e CDK_PASSWORD=secret conduktor login
docker compose -f docker/docker-compose.yml run -e CDK_USER=admin -e CDK_PASSWORD=secret -e CDK_API_KEY="" conduktor get KafkaCluster my_kafka_cluster
docker compose -f docker/docker-compose.yml run conduktor token list admin
docker compose -f docker/docker-compose.yml run conduktor token list application-instance -i=my_app_instance
docker compose -f docker/docker-compose.yml run conduktor token create admin a_admin_token
Expand Down

0 comments on commit 3afb03a

Please sign in to comment.