Skip to content

Commit ed62fde

Browse files
committed
Added UserContextFactory to GraphQLUploadOptions
1 parent 6c0a8e3 commit ed62fde

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/GraphQL.Upload.AspNetCore/GraphQLUploadMiddleware.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ public async Task InvokeAsync(HttpContext context)
9090
Schema = schema,
9191
Query = request.Query,
9292
OperationName = request.OperationName,
93-
Inputs = request.GetInputs()
93+
Inputs = request.GetInputs(),
94+
UserContext = _options.UserContextFactory?.Invoke(context)
9495
}
9596
)));
9697

src/GraphQL.Upload.AspNetCore/GraphQLUploadOptions.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
namespace GraphQL.Upload.AspNetCore
1+
using System;
2+
using Microsoft.AspNetCore.Http;
3+
4+
namespace GraphQL.Upload.AspNetCore
25
{
36
/// <summary>
47
/// Options for <see cref="GraphQLUploadMiddleware{TSchema}"/>.
@@ -14,5 +17,10 @@ public class GraphQLUploadOptions
1417
/// The maximum allowed amount of files. Null indicates no limit at all.
1518
/// </summary>
1619
public long? MaximumFileCount { get; set; }
20+
21+
/// <summary>
22+
/// Gets or sets the user context factory.
23+
/// </summary>
24+
public Func<HttpContext, object> UserContextFactory { get; set; }
1725
}
1826
}

0 commit comments

Comments
 (0)