-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathIWebSocketAuthenticationService.cs
22 lines (21 loc) · 1.3 KB
/
IWebSocketAuthenticationService.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
namespace GraphQL.Server.Transports.AspNetCore.WebSockets;
/// <summary>
/// Authenticates an incoming GraphQL over WebSockets request with the
/// connection initialization message. A typical implementation will
/// set the <see cref="HttpContext.User"/> property after reading the
/// authorization token. This service must be registered as a singleton
/// in the dependency injection framework.
/// </summary>
public interface IWebSocketAuthenticationService
{
/// <summary>
/// Authenticates an incoming GraphQL over WebSockets request with the connection initialization message. The implementation should
/// set the <paramref name="connection"/>.<see cref="IWebSocketConnection.HttpContext">HttpContext</see>.<see cref="HttpContext.User">User</see>
/// property after validating the provided credentials.
/// <br/><br/>
/// After calling this method to authenticate the request, the infrastructure will authorize the incoming request via the
/// <see cref="GraphQLHttpMiddlewareOptions.AuthorizationRequired"/>, <see cref="GraphQLHttpMiddlewareOptions.AuthorizedRoles"/> and
/// <see cref="GraphQLHttpMiddlewareOptions.AuthorizedPolicy"/> properties.
/// </summary>
Task AuthenticateAsync(IWebSocketConnection connection, string subProtocol, OperationMessage operationMessage);
}