private bool IsAuthorized(HttpContext context) { if (_settings.CheckAuthorizationKey) { return(_authorizationLogic.IsValidBotKey(context)); } else { return(true); } }
public void IsValidBotKey_UnitTest(string botKey, bool isValid) { var controller = new HealthController(); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext(); controller.ControllerContext.HttpContext.Request.Headers[Constants.BLIP_BOT_KEY] = botKey; var context = controller.ControllerContext.HttpContext; var check = _authorizationFacade.IsValidBotKey(context); check.ShouldBe(isValid); }
private bool IsAuthorized(HttpContext context) => _settings.CheckAuthorizationKey && !_authorizationLogic.IsValidBotKey(context);