amperity / vault-clj

Clojure client for Hashicorp's Vault secret management system.
Other
70 stars 17 forks source link

Add GitHub auth method. #89

Closed brendonjwong closed 1 year ago

brendonjwong commented 1 year ago

Implemented the GitHub auth's login method. This should resolve https://github.com/amperity/vault-clj/issues/79.

Validated with a local vault server and my personal Github token, using the Amperity organization. I figured it probably didn't make sense to have an integration test for this, but I'm open to ideas for how to durably test this.

Validation steps:

❯ vault write auth/test-mount/config organization=amperity Success! Data written to: auth/test-mount/config

❯ vault write auth/test-mount/map/teams/developers value=default Success! Data written to: auth/test-mount/map/teams/developers


- In the REPL:
```clojure
vault.repl=> (def client (http/http-client "http://127.0.0.1:8200"))
#'vault.repl/client

vault.repl=> (require '[vault.auth.github :as gh])
nil

vault.repl=> (gh/login (gh/with-mount client "test-mount") "<redacted>")
{:accessor "<redacted>",
 :client-token "<redacted>",
 :entity-id "<redacted>",
 :lease-duration 2764800,
 :metadata {:org "amperity", :username "brendonjwong"},
 :mfa-requirement nil,
 :num-uses 0,
 :orphan true,
 :policies ["default"],
 :renewable true,
 :token-policies ["default"],
 :token-type "service"}
codecov-commenter commented 1 year ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (vault-2.x-rewrite@841ced8). Click here to learn what that means. Patch has no changes to coverable lines.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## vault-2.x-rewrite #89 +/- ## ==================================================== Coverage ? 57.16% ==================================================== Files ? 17 Lines ? 1396 Branches ? 31 ==================================================== Hits ? 798 Misses ? 567 Partials ? 31 ``` Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=amperity). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=amperity)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.