Skip to content

Authorization Design CLI

Allan Kerr edited this page Apr 6, 2018 · 2 revisions

Command Line Interface Design

Commands UML

The command line interface is designed to be the entry point into the authorization / identity service.

Configuration

Sharing

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.

Security

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.

Command Model

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:

  1. Create a datastore session from the configuration.
  2. Create a datastore adapter to provide common operations.
  3. Perform the CRUD operation using the adapter.
  4. Return the result.

Commands

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.

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.

Clone this wiki locally