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:
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"
|
||||
|
||||
"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{}
|
||||
|
|
Loading…
Reference in a new issue