This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.AddAuthentication(options => | |
{ | |
options.DefaultScheme = "YOURSCHEMANAME"; | |
options.DefaultAuthenticateScheme = "YOURSCHEMANAME"; | |
}) | |
.AddJwtBearer("Websockets", ctx => { }) | |
.AddIdentityServerAuthentication("YOURSCHEMANAME", options => | |
{ | |
options.ForwardDefaultSelector = context => | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ApolloClient.Examples | |
{ | |
public class AuthenticationSocketInterceptor : ISocketConnectionInterceptor<HttpContext> | |
{ | |
// This is the key to the auth token in the HTTP Context | |
public static readonly string HTTP_CONTEXT_WEBSOCKET_AUTH_KEY = "websocket-auth-token"; | |
// This is the key that apollo uses in the connection init request | |
public static readonly string WEBOCKET_PAYLOAD_AUTH_KEY = "authToken"; | |
private readonly IAuthenticationSchemeProvider _schemes; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class UseOffsetPagingAttribute : DescriptorAttribute | |
{ | |
protected override void TryConfigure( | |
HotChocolate.Types.Descriptors.IDescriptorContext context, | |
IDescriptor descriptor, | |
ICustomAttributeProvider element) | |
{ | |
if (element is MemberInfo m) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run --name mongo -p 27017:27017 -d mongo mongod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function useObjectState<T, K extends keyof T>( | |
key: K, | |
objState: [T, Dispatch<SetStateAction<T>>] | |
): [T[K], (val: T[K]) => void] { | |
const [obj, setObj] = objState; | |
const setKey = (val: T[K]) => setObj({ ...obj, [key]: val }); | |
return [obj[key], setKey]; | |
} |
NewerOlder