Add Output Fields support (#1192)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-05-04 20:57:35 -04:00
1 parent 1948984ca2
commit 22d5c88a0b
84 files changed
+5688 -2122

No files matched your search

+9 -2
View File
@@ -3,10 +3,13 @@ package auth
import (
"context"
"github.com/hashicorp/boundary/internal/requests"
"github.com/hashicorp/boundary/internal/servers/controller/common"
)
// DisabledAuthTestContext is meant for testing, and uses a context that has auth checking entirely disabled
// DisabledAuthTestContext is meant for testing, and uses a context that has
// auth checking entirely disabled. Supported options: WithScopeId an WithUserId
// are used directly; WithKms is passed through into the verifier context.
func DisabledAuthTestContext(iamRepoFn common.IamRepoFactory, scopeId string, opt ...Option) context.Context {
reqInfo := RequestInfo{DisableAuthEntirely: true}
opts := getOpts(opt...)
@@ -15,5 +18,9 @@ func DisabledAuthTestContext(iamRepoFn common.IamRepoFactory, scopeId string, op
reqInfo.scopeIdOverride = scopeId
}
reqInfo.userIdOverride = opts.withUserId
return NewVerifierContext(context.Background(), nil, iamRepoFn, nil, nil, opts.withKms, reqInfo)
if reqInfo.userIdOverride == "" {
reqInfo.userIdOverride = "u_auth"
}
requestContext := context.WithValue(context.Background(), requests.ContextRequestInformationKey, &requests.RequestContext{})
return NewVerifierContext(requestContext, nil, iamRepoFn, nil, nil, opts.withKms, reqInfo)
}