Skip to content

Commit

Permalink
update string used to auth with signjwt
Browse files Browse the repository at this point in the history
  • Loading branch information
catsby committed Apr 27, 2021
1 parent ce432e2 commit 633d077
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions plugin/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ func getSignedJwt(role string, m map[string]string) (string, error) {
return "", errors.New("could not obtain service account from credentials (are you using Application Default Credentials?). You must provide a service account to authenticate as")
}

project, ok := m["project"]
if !ok {
if credentials != nil {
project = credentials.ProjectId
} else {
project = "-"
}
}

ttl := time.Duration(defaultIamMaxJwtExpMinutes) * time.Minute
jwtExpStr, ok := m["jwt_exp"]
if ok {
Expand Down Expand Up @@ -73,7 +64,7 @@ func getSignedJwt(role string, m map[string]string) (string, error) {
return "", fmt.Errorf("could not create IAM client: %v", err)
}

resourceName := fmt.Sprintf("projects/%s/serviceAccounts/%s", project, serviceAccount)
resourceName := fmt.Sprintf(gcputil.ServiceAccountCredentialsTemplate, serviceAccount)
resp, err := iamClient.Projects.ServiceAccounts.SignJwt(resourceName, jwtReq).Do()
if err != nil {
return "", fmt.Errorf("unable to sign JWT for %s using given Vault credentials: %v", resourceName, err)
Expand Down

0 comments on commit 633d077

Please sign in to comment.