Replies: 1 comment
-
|
What's the current status of this (great) RFC? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
RFC 1: CLI Authentication in other STACKIT applications (SDKs, Terraform Provider)
Context and Goal
Currently the STACKIT SDKs and Terraform Provider support the Key Flow and Token
Flow authentication. The STACKIT CLI supports beside these two methods also the
authentication with the personal user account. This kind of authentication is
more convenient because it eliminates the effort of creating a new service
account, grant it permissions, creating service account credentials and
configure the application to use these credentials.
So to improve the overall user experience in authenticating within the STACKIT
applications, we want to reuse the more convenient authentication with the
personal user account in other applications e.g. STACKIT Go SDK and STACKIT
Terraform Provider.
Requirements for the CLI Authentication
We set some requirements for this new feature:
Terraform Provider)
Target Architecture
STACKIT CLI
The STACKIT CLI will get a new subcommand group which will only be used for the
authentication in other applications. The new commands should be similar to the
existing commands, with the difference that the login session will only be used
for other STACKIT applications and not in the CLI itself. This ensures that
future breaking changes of the existing
$ stackit authcommands will notinfluence the authentication for the other applications and we have more control
over the interface between the CLI and the Applications that uses it to
authenticate. If users have to login to different accounts within the CLI itself
and with another account to all other applications, this would be possible as
well. The users would gain more control over the authentication within the CLI.
The CLI should only provide the access-token and refresh-token, there will be no
additional configuration shared. So if users need to use a custom endpoint, they
have to configure it in the CLI itself before calling the login command and need
to set custom endpoints in the STACKIT Application e.g. Terraform Provider, SDK.
Synchronizing other configurations lead to unexpected behaviors from user
perspective.
Interface
The interface between the CLI and the application, can be implemented in
different ways.
Option 1: Using the keychain
In Option 1, the CLI would store the credentials for the CLI Auth for other
applications in the keychain, like it already does for the CLI credentials. With
the difference, that it would store it under a different name, to not mix them,
with the existing keychain entries of the CLI.
Pros:
Cons:
Option 2: Using a new file
In Option 2, the CLI would store the credentials for the CLI Auth for other
applications in a new (json) file.
Pros:
Cons:
Option 3: Accessing the credentials by executing a command
In Option 3, the CLI would get a new command, similar to
$ stackit auth get-access-token. This new command would only exist to sharethe application credentials.
Pros:
Cons:
breaking changes, because the output of the CLI would change.
STACKIT SDK
On default the feature will be disabled and need to be explicit enabled by the
developer who uses the SDK. To enabled this feature, it must be explicit enabled
when creating the service client.
The SDK will read the stored access-token and refresh-token from the CLI, to
authenticate in the STACKIT SDK. When at the same time a service account key or
token is explicit defined in the SDK client, they will be tried first. If both
fails, it will try as last option to use the CLI authentication.
Terraform Provider
This feature will be implement in our STACKIT Terraform Provider as well. Here
the authentication will be also disabled on default and must be explicit enabled
by setting
cli_auth = truein the provider.Our Terraform Provider will have the same behavior as the Go SDK, because it is
build on top of the Go SDK. So when a service account key or token is defined at
the same time, they will be tried first and the cli_auth will be the last
option. It will read the access-token and refresh-token from the CLI like the Go
SDK.
Summary
With the proposed architecture, we ensure that the users have explicit opt-in
for this feature and avoid unexpected behaviors.
Our preferred decision for the interface is to use a combination of Option 1
and 2. If the system has a keychain, we will use it to store there the
credentials. And as fallback we would create a file on the system, to store the
credentials on the disk. With this implementation, the dependency between the
CLI and the SDK is as weak as possible, because it only relies on the keychain
entry or the file and their content.
In the next weeks we will start with implementation in the CLI, where the
credentials for the SDK will be created. After this, we will add the new
authentication method in the Go SDK and integrate it afterwards in the Terraform
Provider. To ensure everything works as expected, we will start with this
feature in beta. After the beta phase, we will integrate this feature in the
Python SDK as well.
Feedback and Discussion
Feel free to give us some feedback to our proposed architecture for the CLI
Authentication.
Beta Was this translation helpful? Give feedback.
All reactions