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 }); } }
private void HandleSAMLAuthResponse(Saml2Configuration config, SAMLInputModel input, bool hasSamlResponse, SAMLSignOnResponseModel response) { _logger.LogInformation($"POST/GET {hasSamlResponse}"); //log response Saml20Assertion assertion = default(Saml20Assertion); try { _logger.LogInformation("Try and validate saml response"); var util = new Utility(_loggerFactory); assertion = util.HandleResponse(config, input.SAMLResponse, null, null, null); } catch (Saml20Exception samlEx) { _logger.LogError(samlEx.ToString()); //logon failed } catch (Exception ex) { //something went really wrong _logger.LogError(ex.ToString()); } _assetionProcessor.Process(assertion); }
public Task <IActionResult> Handle(Saml2Configuration config, SAMLInputModel input) { return(Task.Factory.StartNew <IActionResult>(() => { return new ContentResult(); })); }
public IActionResult HandleSAMLResponse(Saml2Configuration config, SAMLInputModel input) { return(new ContentResult()); }