protected WorkflowState CheckExpirationAndAuthorization(WorkflowContinuation <ContextWrapper> workflowContinuation, ContextWrapper wrapper, Session session)
        {
            // Inspect the route to see if we should do session expiration and/or session authorization checks.
            WorkflowState ret   = WorkflowState.Continue;
            RouteEntry    entry = null;
            PathParams    parms = null;

            if (routeTable.TryGetRouteEntry(wrapper.Context.Verb(), wrapper.Context.Path(), out entry, out parms))
            {
                if (entry.SessionExpirationHandler != null)
                {
                    ret = entry.SessionExpirationHandler(workflowContinuation, wrapper, session, parms);
                }

                if (ret == WorkflowState.Continue)
                {
                    if (entry.AuthorizationHandler != null)
                    {
                        ret = entry.AuthorizationHandler(workflowContinuation, wrapper, session, parms);
                    }
                }
            }

            return(ret);
        }
        /// <summary>
        /// Route the request.  If no route exists, the workflow continues, otherwise, we return the route handler's continuation state.
        /// </summary>
        public WorkflowState Route(WorkflowContinuation <HttpListenerContext> workflowContinuation, HttpListenerContext context)
        {
            WorkflowState ret   = WorkflowState.Continue;
            RouteEntry    entry = null;

            if (routeTable.TryGetRouteEntry(context.Verb(), context.Path(), out entry))
            {
                if (entry.RouteProvider != null)
                {
                    ret = entry.RouteProvider(workflowContinuation, context);
                }
            }

            return(ret);
        }
        /// <summary>
        /// Route the request.  If no route exists, the workflow continues, otherwise, we return the route handler's continuation state.
        /// </summary>
        public WorkflowState Route(WorkflowContinuation <ContextWrapper> workflowContinuation, ContextWrapper wrapper)
        {
            WorkflowState ret     = WorkflowState.Continue;
            RouteEntry    entry   = null;
            Session       session = sessionManager != null ? sessionManager[wrapper.Context] : null;
            PathParams    parms   = null;

            // Makes debugging easier to declare these variable here.
            string verb = wrapper.Context.Verb();
            string path = wrapper.Context.Path();

            if (routeTable.TryGetRouteEntry(verb, path, wrapper.Context.Request.ContentType, out entry, out parms))
            {
                if (entry.RouteHandler != null)
                {
                    ret = entry.RouteHandler(workflowContinuation, wrapper, session, parms);
                }
            }

            return(ret);
        }
Пример #4
0
        protected WorkflowState CheckExpirationAndAuthorization(WorkflowContinuation <HttpListenerContext> workflowContinuation, HttpListenerContext context, Session session)
        {
            // Inspect the route to see if we should do session expiration and/or session authorization checks.
            WorkflowState ret   = WorkflowState.Continue;
            RouteEntry    entry = null;

            if (routeTable.TryGetRouteEntry(context.Verb(), context.Path(), out entry))
            {
                if (entry.SessionExpirationProvider != null)
                {
                    ret = entry.SessionExpirationProvider(workflowContinuation, context, session);
                }

                if (ret == WorkflowState.Continue)
                {
                    if (entry.AuthorizationProvider != null)
                    {
                        ret = entry.AuthorizationProvider(workflowContinuation, context, session);
                    }
                }
            }

            return(ret);
        }