Example #1
0
 public AfterRegistrationHandler(
     ILogger <RegistrationHandler> logger,
     SignatureFlowService signatureFlowService)
 {
     logger_ = logger;
     signatureFlowService_ = signatureFlowService;
 }
        public async Task <HttpStatusCode> UnsignCallback(
            [FromBody] SignedParams creyticket,
            [FromServices] SignatureFlowService signer)
        {
            var callback = await signer.VerifyUnsign(creyticket.creyticket);

            return(await signer.ExecuteCallback(callback.callback, new PostData { issuer = callback.issuer, payload = callback.payload, timestamp = callback.timestamp, version = callback.version }));
        }
        public SignedPayload SignCallback([FromBody] Callback data, [FromServices] SignatureFlowService signer, int accountId)
        {
            // TODO: make sure all exceptions are properly mapped to HTTP codes

            // ensures we do not create callback to random site, may be read that from settings
            // will need to add other pattern in k8s with internal s2s used
            if (!(data.callback.Host.EndsWith("playcrey.com") || data.callback.Host.EndsWith("localhost")))
            {
                throw new ValidationException($"Invalid {nameof(data.callback)}. Must be DNS based and point to playcrey.com or localhost");
            }
            return(signer.Sign(data, accountId, DateTimeOffset.UtcNow));
        }
 public Task <UnsignedPayload> Unsign(
     [FromBody] SignedParams creyticket,
     [FromServices] SignatureFlowService signer)
 {
     return(signer.VerifyUnsign(creyticket.creyticket));
 }