Skip to content

feat: add a cli utility for managing clients #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 6, 2025
Merged

feat: add a cli utility for managing clients #308

merged 6 commits into from
May 6, 2025

Conversation

ltucker
Copy link
Contributor

@ltucker ltucker commented May 2, 2025

Adds a utility for managing auth clients via cli

This pull request introduces a new utility, auth_manage, for managing OAuth2 clients in the diode-server project. It includes updates to the build process, Docker configuration, and documentation, as well as the addition of new Go modules and functionality to support this feature. Below are the most important changes grouped by theme:

Build and Deployment Updates:

  • Updated the Makefile to include auth_manage as a utility, adding corresponding build and Docker targets ($(BUILD_UTILITIES) and docker-compose-dev-auth-manage) for seamless integration into the build pipeline. [1] [2] [3]
  • Modified Dockerfile-build.auth and Dockerfile.auth to build and include the auth_manage binary in the Docker images. [1] [2] [3]

New Utility Implementation:

  • Added a new auth_manage CLI utility in cmd/auth_manage/main.go to allow the creation, retrieval, listing, and deletion of OAuth2 clients.
  • Introduced a script, dev-auth-manage.sh, to simplify running the auth_manage utility in a development environment.

OAuth2 Client Management:

  • Created a ClientManager interface and its implementation using Hydra in auth/manage.go and auth/manage_hydra.go, enabling management of OAuth2 clients (create, retrieve, delete, and list). [1] [2]

Documentation:

  • Updated the README.md to include detailed instructions for provisioning and managing agent credentials using the auth_manage utility, with examples for creating, retrieving, listing, and deleting clients.

Dependency Updates:

  • Added the github.com/ory/hydra-client-go/v2 module to go.mod to support communication with the Hydra OAuth2 server.

Copy link

github-actions bot commented May 2, 2025

Go test coverage

STATUS ELAPSED PACKAGE COVER PASS FAIL SKIP
🟢 PASS 1.09s github.com/netboxlabs/diode/diode-server/auth 22.2% 7 0 0
🟢 PASS 1.02s github.com/netboxlabs/diode/diode-server/authutil 81.1% 12 0 0
🟢 PASS 0.00s github.com/netboxlabs/diode/diode-server/dbstore/postgres 0.0% 0 0 0
🟢 PASS 0.00s github.com/netboxlabs/diode/diode-server/errors 0.0% 0 0 0
🟢 PASS 1.67s github.com/netboxlabs/diode/diode-server/ingester 80.3% 9 0 0
🟢 PASS 1.05s github.com/netboxlabs/diode/diode-server/migrator 70.4% 4 0 0
🟢 PASS 3.35s github.com/netboxlabs/diode/diode-server/netboxdiodeplugin 83.9% 27 0 0
🟢 PASS 1.69s github.com/netboxlabs/diode/diode-server/reconciler 70.7% 38 0 0
🟢 PASS 1.01s github.com/netboxlabs/diode/diode-server/reconciler/applier 85.7% 1 0 0
🟢 PASS 0.00s github.com/netboxlabs/diode/diode-server/reconciler/changeset 0.0% 0 0 0
🟢 PASS 1.28s github.com/netboxlabs/diode/diode-server/reconciler/differ 55.8% 6 0 0
🟢 PASS 1.02s github.com/netboxlabs/diode/diode-server/server 85.7% 14 0 0
🟢 PASS 0.00s github.com/netboxlabs/diode/diode-server/telemetry 0.0% 0 0 0
🟢 PASS 1.01s github.com/netboxlabs/diode/diode-server/version 100.0% 1 0 0

Total coverage: 51.0%

@ltucker ltucker force-pushed the auth_cli branch 2 times, most recently from fe94e74 to 4725890 Compare May 2, 2025 18:29
@ltucker ltucker marked this pull request as ready for review May 2, 2025 20:42
Copy link
Member

@mfiedorowicz mfiedorowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from comments on Dockerfile-build.auth and auth client manager instantiation, works as expected, thank you!

@ltucker ltucker merged commit 7bdb185 into develop May 6, 2025
7 checks passed
@ltucker ltucker deleted the auth_cli branch May 6, 2025 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants