Exemplo n.º 1
0
        public void Handle(Saml2Configuration config, SAMLInputModel input)
        {
            _logger.LogDebug(TraceMessages.SignOnHandlerCalled);

            //What should happen if this is invalid?
            ValidateConfig(config);

            _logger.LogDebug("Check if has SamlResponse");

            var hasSamlResponse = input.HasResponse();
            var response        = new SAMLSignOnResponseModel {
            };

            _logger.LogDebug("Checking requets method");
            _logger.LogDebug($"Method: {_httpContextAccessor.HttpContext.Request.Method}");

            if (_httpContextAccessor.HttpContext.IsGet() && !hasSamlResponse)
            {
                HandleSAMLRequest(config);
            }
            else if (_httpContextAccessor.HttpContext.IsGetOrPost() && hasSamlResponse)
            {
                HandleSAMLAuthResponse(config, input, hasSamlResponse, response);
            }
            else
            {
                _logger.LogWarning("Method was not an expected method!", new
                {
                    Method      = _httpContextAccessor.HttpContext.Request.Method,
                    QueryString = _httpContextAccessor.HttpContext.Request.QueryString,
                    Form        = _httpContextAccessor.HttpContext.Request.Body
                });
            }
        }