Exemple #1
0
        protected override async Task ExecuteAsync(HttpContext context)
        {
            List <GetStatusRequest> request;

            try
            {
                request = await OwnIdSerializer.DeserializeAsync <List <GetStatusRequest> >(context.Request.Body);
            }
            catch
            {
                BadRequest(context.Response);
                return;
            }

            var result = await _getStatusCommand.ExecuteAsync(request);

            context.Response.StatusCode  = StatusCodes.Status200OK;
            context.Response.ContentType = "application/json";

            // TODO: remove after web ui sdk changes enums as strings
            await context.Response.WriteAsync(JsonSerializer.Serialize <object>(result, new JsonSerializerOptions
            {
                PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
                IgnoreNullValues     = true
            }));

            // TODO: uncomment after web ui sdk changes enums as strings
            // await Json(context, result, StatusCodes.Status200OK, false);
        }
Exemple #2
0
        protected override async Task ExecuteAsync(HttpContext httpContext)
        {
            var request = await OwnIdSerializer.DeserializeAsync <ExchangeMagicLinkRequest>(httpContext.Request.Body);

            await JsonAsync(httpContext, await _exchangeMagicLinkCommand.ExecuteAsync(request),
                            StatusCodes.Status200OK);
        }
Exemple #3
0
        protected override async Task ExecuteAsync(HttpContext httpContext)
        {
            var request = await OwnIdSerializer.DeserializeAsync <GenerateContextRequest>(httpContext.Request.Body);

            var result = await _createFlowCommand.ExecuteAsync(request);

            await JsonAsync(httpContext, result, StatusCodes.Status200OK, false);
        }
        protected override async Task ExecuteAsync(HttpContext httpContext)
        {
            var request = await OwnIdSerializer.DeserializeAsync <ApproveActionRequest>(httpContext.Request.Body);

            await _approveActionCommand.ExecuteAsync(request);

            OkNoContent(httpContext.Response);
        }
Exemple #5
0
        public async Task Invoke(HttpContext context)
        {
            var config = await OwnIdSerializer.DeserializeAsync <ConfigToInject>(context.Request.Body);

            _configuration.TFAEnabled            = config.TFAEnabled;
            _configuration.Fido2FallbackBehavior = config.Fido2FallbackBehavior;

            context.Response.StatusCode = StatusCodes.Status204NoContent;
        }
Exemple #6
0
        protected async Task <JwtContainer> GetRequestJwtContainerAsync(HttpContext httpContext)
        {
            var jwtContainer = await OwnIdSerializer.DeserializeAsync <JwtContainer>(httpContext.Request.Body);

            if (string.IsNullOrEmpty(jwtContainer?.Jwt))
            {
                throw new CommandValidationException("No JWT was found in request");
            }

            return(jwtContainer);
        }
Exemple #7
0
        protected override async Task ExecuteAsync(HttpContext httpContext)
        {
            var request = await OwnIdSerializer.DeserializeAsync <AcceptStartRequest>(httpContext.Request.Body);

            var input = new TransitionInput <AcceptStartRequest>(RequestIdentity, GetRequestCulture(httpContext),
                                                                 request, ClientDate);

            var result = await _flowRunner.RunAsync(input, StepType.AcceptStart);

            await JsonAsync(httpContext, result, StatusCodes.Status200OK);
        }
        protected override async Task ExecuteAsync(HttpContext httpContext)
        {
            var request = await OwnIdSerializer.DeserializeAsync <UserIdentification>(httpContext.Request.Body);

            var commandInput = new TransitionInput <UserIdentification>(RequestIdentity, GetRequestCulture(httpContext),
                                                                        request, ClientDate);

            var result = await _flowRunner.RunAsync(commandInput, StepType.CheckUserExistence);

            await JsonAsync(httpContext, result, StatusCodes.Status200OK);
        }
Exemple #9
0
        protected override async Task ExecuteAsync(HttpContext httpContext)
        {
            // TODO: add parsing exception handling to BaseMiddleware
            AddConnectionRequest request;

            try
            {
                request = await OwnIdSerializer.DeserializeAsync <AddConnectionRequest>(httpContext.Request.Body);
            }
            catch
            {
                BadRequest(httpContext.Response);
                return;
            }

            var result = await _addConnectionCommand.ExecuteAsync(request);

            await JsonAsync(httpContext, result, StatusCodes.Status200OK);
        }