1
0
Fork 0
mirror of https://github.com/Luzifer/vault-otp-ui.git synced 2024-11-14 02:52:45 +00:00

Stop using vault builtins

Prevents compiling and vendoring the whole Go world

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2017-06-14 21:24:38 +02:00
parent eafd1b07cb
commit 734b913954
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -9,7 +9,6 @@ import (
"time" "time"
"github.com/hashicorp/vault/api" "github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/builtin/credential/github"
"github.com/pquerna/otp/totp" "github.com/pquerna/otp/totp"
"github.com/prometheus/common/log" "github.com/prometheus/common/log"
) )
@ -59,14 +58,12 @@ func getSecretsFromVault(accessToken string) ([]*token, error) {
return nil, fmt.Errorf("Unable to create client: %s", err) return nil, fmt.Errorf("Unable to create client: %s", err)
} }
handler := &github.CLIHandler{} if s, err := client.Logical().Write("auth/github/login", map[string]interface{}{"token": accessToken}); err != nil || s.Auth == nil {
t, err := handler.Auth(client, map[string]string{"token": accessToken}) return nil, fmt.Errorf("Login did not work: Error = %s", err)
if err != nil { } else {
return nil, err client.SetToken(s.Auth.ClientToken)
} }
client.SetToken(t)
key := cfg.Vault.Prefix key := cfg.Vault.Prefix
resp := []*token{} resp := []*token{}