Files
threshold/internal/auth/testing.go
T

19 lines
663 B
Go
Raw Normal View History

2020-07-22 00:14:28 -04:00
package auth
2021-03-25 03:15:43 -04:00
import (
"context"
"github.com/hashicorp/boundary/internal/servers/controller/common"
)
2020-07-22 00:14:28 -04:00
// DisabledAuthTestContext is meant for testing, and uses a context that has auth checking entirely disabled
2021-03-25 03:15:43 -04:00
func DisabledAuthTestContext(iamRepoFn common.IamRepoFactory, scopeId string, opt ...Option) context.Context {
2020-07-22 00:14:28 -04:00
reqInfo := RequestInfo{DisableAuthEntirely: true}
opts := getOpts(opt...)
2020-09-14 12:30:11 -04:00
reqInfo.scopeIdOverride = opts.withScopeId
2021-03-25 03:15:43 -04:00
if reqInfo.scopeIdOverride == "" {
reqInfo.scopeIdOverride = scopeId
}
reqInfo.userIdOverride = opts.withUserId
2021-03-25 03:15:43 -04:00
return NewVerifierContext(context.Background(), nil, iamRepoFn, nil, nil, opts.withKms, reqInfo)
2020-07-22 00:14:28 -04:00
}