Skip to content

Commit cae3816

Browse files
Update migration guide
1 parent a453980 commit cae3816

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@ The `@skip` and `@include` directives are now disallowed on root subscription fi
2020

2121
Deprecating a field now requires the implemented field in the interface to also be deprecated, as specified in the [draft specification](https://spec.graphql.org/draft/#sec-Objects.Type-Validation).
2222

23+
## Accidental use of `Microsoft.AspNetCore.Authorization.*` attributes throws an error
24+
25+
Since our authorization attributes (`[Authorize]` and `[AllowAnonymous]`) share the same names as the regular ASP.NET attributes, it's easy to accidentally use the wrong ones.
26+
In the worst-case scenario, this could result in your field or type ending up without any authorization being applied!
27+
28+
To prevent this, we've added a check that throws an error during schema generation if it detects `Microsoft.AspNetCore.Authorization.*` attributes being applied to a GraphQL resolver.
29+
30+
> Note: Keep in mind that your clients might currently rely on the absence of authorization.
31+
32+
You can disable this new validation by setting the `ErrorOnAspNetCoreAuthorizationAttributes` option to `false`:
33+
34+
```csharp
35+
builder.Services.AddGraphQLServer()
36+
.ModifyOptions(options => {
37+
options.ErrorOnAspNetCoreAuthorizationAttributes = false;
38+
})
39+
```
40+
2341
# Deprecations
2442

2543
Things that will continue to function this release, but we encourage you to move away from.

0 commit comments

Comments
 (0)