public ProfiledViewModelDocument(IServiceLocator services, IFubuRequest request) : base(services, request)
        {
            Get <HtmlTags.Conventions.ActiveProfile>().Push("foo");
            HtmlTag tag = Builder(this);

            Add(tag);
        }
Exemple #2
0
        public AuthorizationRight RightsFor(IFubuRequest request)
        {
            var entityFilter = new SingleEntityFilter <T>(request.Get <T>());

            _dataRestrictions.Each(entityFilter.ApplyRestriction);
            return(entityFilter.CanView ? AuthorizationRight.None : AuthorizationRight.Deny);
        }
Exemple #3
0
 public HandlerInvoker(IFubuRequest request, THandler handler, IInvocationContext context, HandlerInvocation <THandler> invocation) : base(PartialBehavior.Executes)
 {
     _request    = request;
     _handler    = handler;
     _context    = context;
     _invocation = invocation;
 }
 public ZeroInOneOutActionInvoker(IFubuRequest request, TController controller, Func <TController, TOutput> action)
     : base(PartialBehavior.Executes)
 {
     _request    = request;
     _controller = controller;
     _action     = action;
 }
 public RenderJavaScriptBehavior(IOutputWriter writer, IFubuRequest request)
     : base(PartialBehavior.Executes)
 {
     _writer = writer;
     _request = request;
     _mimeType = "text/javascript";
 }
Exemple #6
0
 public AjaxValidationBehavior(IValidationFilter <T> filter, IFubuRequest request, IAjaxValidationFailureHandler failure)
     : base(PartialBehavior.Ignored)
 {
     _filter  = filter;
     _request = request;
     _failure = failure;
 }
Exemple #7
0
 public AjaxValidationFailureHandler(IAjaxContinuationResolver resolver, IOutputWriter output, IFubuRequest request, ValidationSettings settings)
 {
     _resolver = resolver;
     _output   = output;
     _request  = request;
     _settings = settings;
 }
Exemple #8
0
 public FubuSmartRequest(IRequestData data, IObjectConverter converter, IFubuRequest request)
     : base(data, converter)
 {
     _data = data;
     _converter = converter;
     _request = request;
 }
Exemple #9
0
 public PartialInvoker(IPartialFactory factory, IFubuRequest request, IAuthorizationPreviewService authorization, ITypeResolver types)
 {
     _factory       = factory;
     _request       = request;
     _authorization = authorization;
     _types         = types;
 }
 public ProductNotFoundConvention(IOutputWriter outputWriter, IUrlRegistry urlRegistry, IFubuRequest fubuRequest)
     : base(PartialBehavior.Executes)
 {
     _outputWriter = outputWriter;
     _urlRegistry  = urlRegistry;
     _fubuRequest  = fubuRequest;
 }
        protected AuthorizationRight IsAuthorized(IFubuRequest request, IEnumerable <IAuthorizationPolicy> policies,
                                                  Action <IAuthorizationPolicy, AuthorizationRight> rightsDiscoveryAction)
        {
            // Check every authorization policy for this endpoint
            var rights = policies.Select(policy =>
            {
                var policyRights = policy.RightsFor(request);


                if (rightsDiscoveryAction != null)
                {
                    rightsDiscoveryAction(policy, policyRights);
                }

                _logger.DebugMessage(() => new AuthorizationPolicyResult(policy, policyRights));

                return(policyRights);
            });

            // Combine the results
            var result = AuthorizationRight.Combine(rights);

            _logger.DebugMessage(() => new AuthorizationResult(result));

            return(result);
        }
Exemple #12
0
 public ConnegBehavior(IFubuRequest request, IActionBehavior inner, IConnegInputHandler inputHandler, IConnegOutputHandler outputHandler)
 {
     _request       = request;
     _inner         = inner;
     _inputHandler  = inputHandler;
     _outputHandler = outputHandler;
 }
Exemple #13
0
 public RequestOutputCacheBehavior(IFubuRequest request, IRequestOutputCache <TInputModel> cache, IOutputWriter writer, IActionBehavior inner)
 {
     _request = request;
     _writer  = writer;
     _inner   = inner;
     _cache   = cache;
 }
Exemple #14
0
 public CommandsToPickUpBehaviour(IFubuRequest request, IOutputWriter writer, IDocumentSession session)
     : base(PartialBehavior.Ignored)
 {
     this.request = request;
     this.writer  = writer;
     this.session = session;
 }
 public ActionExceptionWrapper(IFubuRequest request, IPartialFactory factory, IOutputWriter writer, ILogger logger)
 {
     _request = request;
     _factory = factory;
     _writer  = writer;
     _logger  = logger;
 }
Exemple #16
0
 public InputBehavior(IOutputWriter writer, IFubuRequest request, IEnumerable <IReader <T> > readers, ILogger logger) : base(PartialBehavior.Executes)
 {
     _writer  = writer;
     _request = request;
     _readers = readers;
     _logger  = logger;
 }
 public RenderCssBehavior(IOutputWriter writer, IFubuRequest request)
     : base(PartialBehavior.Executes)
 {
     _writer = writer;
     _request = request;
     _mimeType = "text/css";
 }
 public SendMessageBehavior(IFubuRequest request, IServiceBus serviceBus, ILogger logger)
     : base(PartialBehavior.Executes)
 {
     _request    = request;
     _serviceBus = serviceBus;
     _logger     = logger;
 }
Exemple #19
0
 private ElementGenerator(ITagGenerator <ElementRequest> tags, IFubuRequest request)
 {
     _tags  = tags;
     _model = new Lazy <T>(() => {
         return(request.Get <T>());
     });
 }
 public MessageFubuDiagnostics(IQueueMessageRetrieval queueMessageRetrieval, IEnvelopeSerializer serializer,
                               IFubuRequest fubuRequest)
 {
     _queueMessageRetrieval = queueMessageRetrieval;
     _serializer            = serializer;
     _fubuRequest           = fubuRequest;
 }
Exemple #21
0
        public FormTagModelDocument(IServiceLocator services, IFubuRequest request) : base(services, request)
        {
            HtmlTag formTag = FormRequestEndpoint.Build(this);


            Add(formTag);
        }
 public TwitterResponseHandler(IFubuRequest request, IOutputWriter writer, IPartialFactory factory, BehaviorGraph graph)
 {
     _request = request;
     _writer = writer;
     _factory = factory;
     _graph = graph;
 }
Exemple #23
0
 public ValidationBehavior(IJsonWriter jsonWriter, IFubuRequest request,
                           IValidator <T> validator) : base(PartialBehavior.Ignored)
 {
     _jsonWriter = jsonWriter;
     _request    = request;
     _validator  = validator;
 }
 public CommandsToPickUpBehaviour(IFubuRequest request,IOutputWriter writer,IDocumentSession session)
     : base(PartialBehavior.Ignored)
 {
     this.request = request;
     this.writer = writer;
     this.session = session;
 }
 public MessageFubuDiagnostics(IQueueMessageRetrieval queueMessageRetrieval, IEnvelopeSerializer serializer,
     IFubuRequest fubuRequest)
 {
     _queueMessageRetrieval = queueMessageRetrieval;
     _serializer = serializer;
     _fubuRequest = fubuRequest;
 }
 public AjaxValidationFailureHandler(IAjaxContinuationResolver resolver, IOutputWriter output, IFubuRequest request, ValidationSettings settings)
 {
     _resolver = resolver;
     _output = output;
     _request = request;
     _settings = settings;
 }
 public AuthorizationBehavior(IAuthorizationFailureHandler failureHandler, IFubuRequest request, IEnumerable<IAuthorizationPolicy> policies)
     : base(PartialBehavior.Executes)
 {
     _failureHandler = failureHandler;
     _request = request;
     _policies = policies;
 }
Exemple #28
0
 public OutputBehavior(IFubuRequest request, IOutputWriter writer, IEnumerable <IMedia <T> > media, ILogger logger) : base(PartialBehavior.Executes)
 {
     _request = request;
     _writer  = writer;
     _media   = media;
     _logger  = logger;
 }
Exemple #29
0
 public ConnegInputBehavior(IEnumerable <IMediaReader <T> > readers, IOutputWriter writer, IFubuRequest request)
     : base(PartialBehavior.Executes)
 {
     _readers = readers;
     _writer  = writer;
     _request = request;
 }
Exemple #30
0
 public CascadingHandlerInvoker(IFubuRequest request, THandler handler, Func <THandler, TInput, TOutput> action, IInvocationContext messages) : base(PartialBehavior.Executes)
 {
     _request  = request;
     _handler  = handler;
     _action   = action;
     _messages = messages;
 }
 public MovieViewModelJsonBehavior(IOutputWriter writer, IFubuRequest request, IRequestData requestData)
     : base(PartialBehavior.Executes)
 {
     this.writer = writer;
     this.request = request;
     this.requestData = requestData;
 }
 public ValidationBehavior(IFubuRequest request, IValidator provider, IValidationFailureHandler failureHandler)
     : base(PartialBehavior.Executes)
 {
     _request        = request;
     _failureHandler = failureHandler;
     _provider       = provider;
 }
        private FormRequest requestFor <T>() where T : class, new()
        {
            var services = new InMemoryServiceLocator();

            services.Add <IChainResolver>(new ChainResolutionCache(theGraph));
            services.Add <IChainUrlResolver>(new ChainUrlResolver(new OwinHttpRequest()));

            theRequest      = new InMemoryFubuRequest();
            theNotification = Notification.Valid();
            theRequest.Set(theNotification);

            services.Add(theRequest);

            var request = new FormRequest(new ChainSearch {
                Type = typeof(T)
            }, new T());

            request.Attach(services);
            request.ReplaceTag(new FormTag("test"));

            theContinuation = AjaxContinuation.Successful();
            theContinuation.ShouldRefresh = true;

            var resolver = MockRepository.GenerateStub <IAjaxContinuationResolver>();

            resolver.Stub(x => x.Resolve(theNotification)).Return(theContinuation);

            services.Add(resolver);

            return(request);
        }
Exemple #34
0
 public AuthorizationBehavior(IAuthorizationPolicyExecutor policyExecutor, IAuthorizationFailureHandler failureHandler, IFubuRequest request, IEnumerable <IAuthorizationPolicy> policies) : base(PartialBehavior.Executes)
 {
     _policyExecutor = policyExecutor;
     _failureHandler = failureHandler;
     _request        = request;
     _policies       = policies;
 }
Exemple #35
0
 public FakeJsonBehavior(IJsonWriter writer, IFubuRequest request, IRequestData data)
     : base(writer, request)
 {
     Writer  = writer;
     Request = request;
     Data    = data;
 }
 public OAuth2ResponseHandler(IFubuRequest request, IOutputWriter writer, IPartialFactory factory, BehaviorGraph graph)
 {
     _request = request;
     _writer  = writer;
     _factory = factory;
     _graph   = graph;
 }
 public MessageExecutor(IPartialFactory factory, IFubuRequest request, IChainResolver resolver, ILogger logger, Envelope envelope)
 {
     _factory = factory;
     _request = request;
     _resolver = resolver;
     _logger = logger;
     _envelope = envelope;
 }
Exemple #38
0
        public DiagnosticBehavior(IDebugReport report, IDebugDetector detector, IRequestHistoryCache history, IDebugCallHandler debugCallHandler, IFubuRequest request)
        {
            _report = report;
            _debugCallHandler = debugCallHandler;
            _detector = detector;

            _initialize = () => history.AddReport(report, request.Get<CurrentRequest>());
        }
        public virtual AuthorizationRight IsAuthorized(IFubuRequest request, IEnumerable<IAuthorizationPolicy> policies)
        {
            // Check every authorization policy for this endpoint
            var rights = policies.Select(x => x.RightsFor(request));

            // Combine the results
            return AuthorizationRight.Combine(rights);
        }
 public ContinuationHandler(IUrlRegistry registry, IOutputWriter writer, IFubuRequest request, IPartialFactory factory, IChainResolver resolver)
 {
     _registry = registry;
     _writer = writer;
     _request = request;
     _factory = factory;
     _resolver = resolver;
 }
 public FubuContinuationFailurePolicy(Func<ValidationFailure, bool> predicate, IFubuRequest request,
     IFubuContinuationResolver continuationResolver, IValidationContinuationHandler handler)
 {
     _predicate = predicate;
     _handler = handler;
     _continuationResolver = continuationResolver;
     _request = request;
 }
 public MustBeAuthenticatedBehaviour(ISecurityContext securityContext, IOutputWriter writer, IUrlRegistry urls, IFubuRequest request)
     : base(PartialBehavior.Ignored)
 {
     _securityContext = securityContext;
     _writer = writer;
     _urls = urls;
     _request = request;
 }
 public AjaxExceptionWrapper(IFubuRequest request, IPartialFactory factory, IJsonWriter writer,
     HttpContext httpContext, IOutputWriter output)
 {
     _request = request;
     _writer = writer;
     _httpContext = httpContext;
     _output = output;
 }
 public ConnegOutputBehavior(IValueSource <T> source, IFubuRequest request, IOutputWriter writer,
                             IEnumerable <IMediaWriter <T> > writers) : base(PartialBehavior.Executes)
 {
     _source  = source;
     _request = request;
     _writer  = writer;
     _writers = writers;
 }
 public ContinuationHandler(IUrlRegistry registry, IOutputWriter writer, IFubuRequest request, IPartialFactory factory, IChainResolver resolver)
 {
     _registry = registry;
     _writer   = writer;
     _request  = request;
     _factory  = factory;
     _resolver = resolver;
 }
 public LoginBehavior(ICurrentHttpRequest httpRequest, IAuthenticationService service, IFubuRequest request, ILoginSuccessHandler handler)
     : base(PartialBehavior.Ignored)
 {
     _httpRequest = httpRequest;
     _service = service;
     _request = request;
     _handler = handler;
 }
 public ValidationContinuationHandler(IUrlRegistry registry, IOutputWriter writer, IFubuRequest request,
     IPartialFactory factory)
 {
     _registry = registry;
     _writer = writer;
     _request = request;
     _factory = factory;
 }
Exemple #48
0
 public CascadingAsyncHandlerInvoker(IFubuRequest request, THandler handler, Func <THandler, TInput, Task <TOutput> > func, IAsyncHandling asyncHandling)
     : base(PartialBehavior.Executes)
 {
     _request       = request;
     _handler       = handler;
     _func          = func;
     _asyncHandling = asyncHandling;
 }
 public MessageExecutor(IPartialFactory factory, IFubuRequest request, HandlerGraph graph, ILogger logger, Envelope envelope)
 {
     _factory = factory;
     _request = request;
     _graph = graph;
     _logger = logger;
     _envelope = envelope;
 }
 public FubuContinuationFailurePolicy(Func<Type, bool> predicate, IFubuRequest request, 
     FubuContinuation continuation, ContinuationHandler handler)
 {
     _predicate = predicate;
     _handler = handler;
     _continuation = continuation;
     _request = request;
 }
 public ExceptionHandlerBehavior(IActionBehavior behavior, HandlerChain chain, Envelope envelope, IInvocationContext context, ILogger logger, IFubuRequest request)
 {
     _behavior = behavior;
     _chain = chain;
     _envelope = envelope;
     _context = context;
     _logger = logger;
     _request = request;
 }
 public MustBeAuthorizedBehavior(ActionCall actionCall, ISecurityContext securityContext, IUrlRegistry urls, IFubuRequest request, IOutputWriter writer)
     : base(PartialBehavior.Ignored)
 {
     _actionCall = actionCall;
     _securityContext = securityContext;
     _urls = urls;
     _request = request;
     _writer = writer;
 }
        public TwitterProxy(IConsumerTokenManager manager, ISignInEndpointBuilder endpointBuilder,
            IFubuRequest request, ISystemUrls urls)
        {
            _request = request;
            _urls = urls;

            var endpoints = endpointBuilder.Build();
            _consumer = new WebConsumer(endpoints, manager);
        }
        public AuthorizationRight RightsFor(IFubuRequest request)
        {
            var athleteId = request.Get<AthleteSpecific>().AthleteId;
            var athlete = session.Load<Athlete>(athleteId);

            if (athlete.UserName == secContext.CurrentIdentity.Name)
                return AuthorizationRight.Allow;
            return AuthorizationRight.Deny;
        }
 public AuthorizationRight RightsFor(IFubuRequest request)
 {
     var athlete = session
         .Query<Athlete,AthletesByUserName>()
         .SingleOrDefault(a => a.UserName == secContext.CurrentIdentity.Name);
     if (athlete == null || !athlete.IsAdmin)
         return AuthorizationRight.Deny;
     return AuthorizationRight.Allow;
 }
        public AuthorizationRight RightsFor(IFubuRequest request)
        {
            var customerId = request.Get<Customer>().Id;
            var productId = request.Get<Product>().Id;

            var hasPurchasedProduct = _repository.Get<IPurchaseHistory>(customerId)
                .Any(x => x.ContainsProduct(productId));

            return !hasPurchasedProduct ? AuthorizationRight.Deny : AuthorizationRight.Allow;
        }
 public ContinuationHandler(
     IUrlRegistry registry,
     IOutputWriter writer,
     IFubuRequest request,
     IPartialFactory factory)
     : base(PartialBehavior.Ignored)
 {
     _registry = registry;
     _writer = writer;
     _request = request;
     _factory = factory;
 }
 public LoginResultBehavior(
     IFubuRequest request, 
     IUrlRegistry registry,
     IOutputWriter writer,
     IActionBehavior innerBehavior,
     IPartialFactory factory
 )
 {
     this.request = request;
     this.registry = registry;
     this.writer = writer;
     this.innerBehavior = innerBehavior;
     this.factory = factory;
 }
        public void SetUp()
        {
            _page = MockRepository.GenerateStub<IFubuPage>();
            _partialFactory = MockRepository.GenerateStub<IPartialFactory>();
            _behavior = new WrappingBehavior();
            PartialInvokingHandler = MockRepository.GenerateStub<IPartialInvokingHandler>();
            _behavior.InsideBehavior = new PartialHandlingBehavior();

            _partialFactory.Stub(f => f.BuildPartial(typeof(InputModel))).Return(_behavior);
            _page.Stub(p => p.Get<IPartialFactory>()).Return(_partialFactory);

            _request = MockRepository.GenerateStub<IFubuRequest>();
            _page.Stub(p => p.Get<IFubuRequest>()).Return(_request);
        }
 public SparkRenderViewBehavior(
     ISparkViewRenderer<IFubuView> viewRenderder,
     IServiceLocator serviceLocator,
     IFubuRequest request,
     SparkViewToken viewToken,
     ActionCall actionCall,
     IOutputWriter writer)
     : base(PartialBehavior.Executes)
 {
     _viewRenderder = viewRenderder;
     _serviceLocator = serviceLocator;
     _request = request;
     _viewToken = viewToken;
     _actionCall = actionCall;
     _writer = writer;
 }