Update GCP auth plugin (#5043)

Fixes #5037
This commit is contained in:
Jim Kalafut 2018-08-03 14:56:02 -07:00 committed by Brian Kassouf
parent fcb82c2444
commit 2a8f368ef8
2 changed files with 6 additions and 7 deletions

View File

@ -8,9 +8,9 @@ import (
"github.com/hashicorp/go-cleanhttp"
"github.com/hashicorp/go-gcp-common/gcputil"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/helper/parseutil"
"golang.org/x/oauth2"
"google.golang.org/api/iam/v1"
"strconv"
"strings"
"time"
)
@ -44,15 +44,14 @@ func getSignedJwt(role string, m map[string]string) (string, error) {
}
}
var ttlMin = int64(defaultIamMaxJwtExpMinutes)
var ttl = time.Duration(defaultIamMaxJwtExpMinutes) * time.Minute
jwtExpStr, ok := m["jwt_exp"]
if ok {
ttlMin, err = strconv.ParseInt(jwtExpStr, 10, 64)
ttl, err = parseutil.ParseDurationSecond(jwtExpStr)
if err != nil {
return "", fmt.Errorf("could not parse jwt_exp '%s' into integer value", jwtExpStr)
}
}
ttl := time.Minute * time.Duration(ttlMin)
jwtPayload := map[string]interface{}{
"aud": fmt.Sprintf("http://vault/%s", role),

6
vendor/vendor.json vendored
View File

@ -1309,10 +1309,10 @@
"revisionTime": "2018-06-06T02:20:31Z"
},
{
"checksumSHA1": "SMQTceFhHRKV9aFfpy7YUdL/BSY=",
"checksumSHA1": "SjXo3W6G8ippBVEZpYe63C2/KJo=",
"path": "github.com/hashicorp/vault-plugin-auth-gcp/plugin",
"revision": "88de4611ed29dc576719b15cae2c943e6ecc992f",
"revisionTime": "2018-07-10T20:29:00Z"
"revision": "ce466e5ee54ee8b93ab3b15ac5b7df564f3412dc",
"revisionTime": "2018-08-03T20:34:32Z"
},
{
"checksumSHA1": "en64nC2RYQjJuHMcWMqwmDBU9bc=",