Repository navigation
Authorization Design CLI

The command line interface is designed to be the entry point into the authorization / identity service.
Because the service may be started with many different commands, the command line interface has been designed to also initialize the service's configuration. This design decision allows for the configuration to be initialized and provided to the command that is executed. This increases evolvability by ensuring that the same configuration is used for all commands even as the configuration changes.
Because the configuration contains secure credentials that should not be present in the source code, configuration initialization was designed to use environment variables. This design decision allows credentials to be stored in secure Kubernetes secrets.
All commands are provided with the service configuration when they are executed. This design gives all commands the ability to establish a database connection. Because the majority of the commands are based around performing a simple CRUD operation on the datastore, most commands follow the same design:
- Create a datastore session from the configuration.
- Create a datastore adapter to provide common operations.
- Perform the CRUD operation using the adapter.
- Return the result.
The commands are designed to have a Cobra command handler and the command implementation in two separate functions. This design decision was made to increase separation to improve testability.
1. Host Command
The host command is the only command that doesn't follow the standardized command model. This design decision was made because the host command is a special command designed to start the service. This command is designed to never return because it initializes the service and listens indefinitely for requests.
This command is designed to follow the standardized command model by performing a simple create operation to create a new OAuth2 client.
This command is designed to follow the standardized command model by performing a simple update operation to add a new scope to an existing OAuth2 client.
This command is designed to follow the standardized command model by performing a simple update operation to add a new scope to an existing user client.