mirror of
https://github.com/Luzifer/vault-otp-ui.git
synced 2024-11-12 18:12: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:
parent
eafd1b07cb
commit
734b913954
1 changed files with 4 additions and 7 deletions
11
token.go
11
token.go
|
@ -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{}
|
||||||
|
|
Loading…
Reference in a new issue