diff --git a/registry/auth/token/token_test.go b/registry/auth/token/token_test.go index cbfe2a6b4..03dce6fa6 100644 --- a/registry/auth/token/token_test.go +++ b/registry/auth/token/token_test.go @@ -454,6 +454,27 @@ func TestAccessController(t *testing.T) { if userInfo.Name != "foo" { t.Fatalf("expected user name %q, got %q", "foo", userInfo.Name) } + + // 5. Supply a token with full admin rights, which is represented as "*". + token, err = makeTestToken( + issuer, service, + []*ResourceActions{{ + Type: testAccess.Type, + Name: testAccess.Name, + Actions: []string{"*"}, + }}, + rootKeys[0], 1, time.Now(), time.Now().Add(5*time.Minute), + ) + if err != nil { + t.Fatal(err) + } + + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token.compactRaw())) + + _, err = accessController.Authorized(ctx, testAccess) + if err != nil { + t.Fatalf("accessController returned unexpected error: %s", err) + } } // This tests that newAccessController can handle PEM blocks in the certificate