Don't rely on token for scopes collection actions This requires `scope_id` to be passed (via query param) for actions on the scopes collection; that is, listing or creating. However, it removes the dependency on using the token for the scope of the command. For actions on a specific scope, we use the given ID to determine the scope we should be operating at, doing a lookup if necessary. Existing tests have been updated. Of particular note, the CORS test was already operating on the scopes collection so served as a good test to ensure that from an API level the scope_id parameter was being parsed and passed through (the tests fail without adding that query parameter in).
12 lines
398 B
Go
12 lines
398 B
Go
package auth
|
|
|
|
import "context"
|
|
|
|
// DisabledAuthTestContext is meant for testing, and uses a context that has auth checking entirely disabled
|
|
func DisabledAuthTestContext(opt ...Option) context.Context {
|
|
reqInfo := RequestInfo{DisableAuthEntirely: true}
|
|
opts := getOpts(opt...)
|
|
reqInfo.scopeIdOverride = opts.withScopeId
|
|
return NewVerifierContext(context.Background(), nil, nil, nil, reqInfo)
|
|
}
|