When using a disabled verifier context we were faking scope information. Due to other recent changes, this was now causing test errors. This adjusts that flow to actually query the DB, fixing tests and making them more like real code.
20 lines
663 B
Go
20 lines
663 B
Go
package auth
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/hashicorp/boundary/internal/servers/controller/common"
|
|
)
|
|
|
|
// DisabledAuthTestContext is meant for testing, and uses a context that has auth checking entirely disabled
|
|
func DisabledAuthTestContext(iamRepoFn common.IamRepoFactory, scopeId string, opt ...Option) context.Context {
|
|
reqInfo := RequestInfo{DisableAuthEntirely: true}
|
|
opts := getOpts(opt...)
|
|
reqInfo.scopeIdOverride = opts.withScopeId
|
|
if reqInfo.scopeIdOverride == "" {
|
|
reqInfo.scopeIdOverride = scopeId
|
|
}
|
|
reqInfo.userIdOverride = opts.withUserId
|
|
return NewVerifierContext(context.Background(), nil, iamRepoFn, nil, nil, opts.withKms, reqInfo)
|
|
}
|