forked from remote/oauth2
Changes requested by @codyoss
This commit is contained in:
@@ -15,6 +15,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var serviceAccountImpersonationCompiler = regexp.MustCompile("https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/(.*@.*):generateAccessToken")
|
||||||
|
|
||||||
const (
|
const (
|
||||||
executableSupportedMaxVersion = 1
|
executableSupportedMaxVersion = 1
|
||||||
defaultTimeout = 30 * time.Second
|
defaultTimeout = 30 * time.Second
|
||||||
@@ -57,7 +59,7 @@ func exitCodeError(exitCode int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func executableError(err error) error {
|
func executableError(err error) error {
|
||||||
return fmt.Errorf("oauth2/google: executable command failed: %v", err.Error())
|
return fmt.Errorf("oauth2/google: executable command failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func executablesDisallowedError() error {
|
func executablesDisallowedError() error {
|
||||||
@@ -73,10 +75,6 @@ var runCommand = func(ctx context.Context, command string, env []string) ([]byte
|
|||||||
cmd.Env = env
|
cmd.Env = env
|
||||||
|
|
||||||
response, err := cmd.Output()
|
response, err := cmd.Output()
|
||||||
if ctx.Err() != nil {
|
|
||||||
return nil, ctx.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return response, nil
|
return response, nil
|
||||||
}
|
}
|
||||||
@@ -201,8 +199,6 @@ func (cs executableCredentialSource) getEnvironment() []string {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
var serviceAccountImpersonationCompiler = regexp.MustCompile("https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/(.*@.*):generateAccessToken")
|
|
||||||
|
|
||||||
func (cs executableCredentialSource) getNewEnvironmentVariables() map[string]string {
|
func (cs executableCredentialSource) getNewEnvironmentVariables() map[string]string {
|
||||||
result := map[string]string{
|
result := map[string]string{
|
||||||
"GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE": cs.config.Audience,
|
"GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE": cs.config.Audience,
|
||||||
|
|||||||
@@ -28,10 +28,6 @@ func String(s string) *string {
|
|||||||
return &s
|
return &s
|
||||||
}
|
}
|
||||||
|
|
||||||
var emptyEnv = func() []string {
|
|
||||||
return []string{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCreateExecutableCredential(t *testing.T) {
|
func TestCreateExecutableCredential(t *testing.T) {
|
||||||
ec := ExecutableConfig{
|
ec := ExecutableConfig{
|
||||||
Command: "blarg",
|
Command: "blarg",
|
||||||
|
|||||||
Reference in New Issue
Block a user