@@ -24,6 +24,7 @@ import (
|
||||
"go.probo.inc/probo/pkg/coredata"
|
||||
"go.probo.inc/probo/pkg/gid"
|
||||
"go.probo.inc/probo/pkg/iam/oauth2"
|
||||
"go.probo.inc/probo/pkg/iam/scopeset"
|
||||
)
|
||||
|
||||
func TestAuthorizer_checkOAuth2Scope(t *testing.T) {
|
||||
@@ -65,15 +66,14 @@ func TestAuthorizer_checkOAuth2Scope(t *testing.T) {
|
||||
t.Run("allows when registered scopes authorize the action", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
a := NewAuthorizer(nil, nil)
|
||||
a.RegisterScopes(
|
||||
CreateScopeSet(
|
||||
map[coredata.OAuth2Scope][]Action{
|
||||
scopeV1OrgRead: {action},
|
||||
},
|
||||
),
|
||||
scopeSet := scopeset.New().Register(
|
||||
map[coredata.OAuth2Scope][]string{
|
||||
scopeV1OrgRead: {action},
|
||||
},
|
||||
)
|
||||
|
||||
a := NewAuthorizer(nil, nil, scopeSet)
|
||||
|
||||
ctx := oauth2.ContextWithAccessToken(
|
||||
context.Background(),
|
||||
&coredata.OAuth2AccessToken{Scopes: coredata.OAuth2Scopes{scopeV1OrgRead}},
|
||||
|
||||
Reference in New Issue
Block a user