1
0
Fork 0
mirror of https://github.com/Luzifer/vault-otp-ui.git synced 2024-11-09 16:50:05 +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"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/builtin/credential/github"
"github.com/pquerna/otp/totp"
"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)
}
handler := &github.CLIHandler{}
t, err := handler.Auth(client, map[string]string{"token": accessToken})
if err != nil {
return nil, err
if s, err := client.Logical().Write("auth/github/login", map[string]interface{}{"token": accessToken}); err != nil || s.Auth == nil {
return nil, fmt.Errorf("Login did not work: Error = %s", err)
} else {
client.SetToken(s.Auth.ClientToken)
}
client.SetToken(t)
key := cfg.Vault.Prefix
resp := []*token{}