diff --git a/lib/owin/Microsoft.Owin.Host.SystemWeb.dll b/lib/owin/Microsoft.Owin.Host.SystemWeb.dll new file mode 100644 index 000000000..6c8d50b16 Binary files /dev/null and b/lib/owin/Microsoft.Owin.Host.SystemWeb.dll differ diff --git a/lib/owin/Microsoft.Owin.Host.SystemWeb.xml b/lib/owin/Microsoft.Owin.Host.SystemWeb.xml new file mode 100644 index 000000000..c164a1675 --- /dev/null +++ b/lib/owin/Microsoft.Owin.Host.SystemWeb.xml @@ -0,0 +1,526 @@ + + + + Microsoft.Owin.Host.SystemWeb + + + + + Locates the startup class based on the following convention: + AssemblyName.Startup, with a method named Configuration + + + + + + + + + + Allows for a fallback loader to be specified. + + + + + + Allows for a fallback loader and a Dependency Injection activator to be specified. + + + + + + + + + + + + + + + Executes the loader, searching for the entry point by name. + + The name of the assembly and type entry point + + + + + + + + + + + + + A default fallback loader that does nothing. + + + + + A placeholder method that always returns null. + + + + null. + + + + A singleton instance of the NullLoader type. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to For the app startup parameter value '{0}', the assembly '{1}' was not found.. + + + + + Looks up a localized string similar to For the app startup parameter value '{0}', the class '{1}' was not found in assembly '{2}'.. + + + + + Looks up a localized string similar to The OwinStartup attribute discovered in assembly '{0}' referencing startup type '{1}' conflicts with the attribute in assembly '{2}' referencing startup type '{3}' because they have the same FriendlyName '{4}'. Remove or rename one of the attributes, or reference the desired type directly.. + + + + + Looks up a localized string similar to The discovered startup type '{0}' conflicts with the type '{1}'. Remove or rename one of the types, or reference the desired type directly.. + + + + + Looks up a localized string similar to The OwinStartupAttribute.FriendlyName value '{0}' does not match the given value '{1}' in Assembly '{2}'.. + + + + + Looks up a localized string similar to No '{0}' method was found in class '{1}'.. + + + + + Looks up a localized string similar to No assembly found containing a Startup or [AssemblyName].Startup class.. + + + + + Looks up a localized string similar to No assembly found containing an OwinStartupAttribute.. + + + + + Looks up a localized string similar to The OwinStartupAttribute.StartupType value is empty in Assembly '{0}'.. + + + + + Looks up a localized string similar to The type '{0}' referenced from assembly '{1}' does not define a property 'StartupType' of type 'Type'.. + + + + + Looks up a localized string similar to The given type or method '{0}' was not found. Try specifying the Assembly.. + + + + + Looks up a localized string similar to The '{0}' method on class '{1}' does not have the expected signature 'void {0}(IAppBuilder)'.. + + + + + Used to provide the data protection services that are derived from the MachineKey API. It is the best choice of + data protection when you application is hosted by ASP.NET and all servers in the farm are running with the same Machine Key values. + + + + + Returns a new instance of IDataProtection for the provider. + + Additional entropy used to ensure protected data may only be unprotected for the correct purposes. + An instance of a data protection service + + + + Provides extension methods for . + + + + + Gets the for the current request. + + + + + + + Gets the for the current request. + + + + + + + Provides extension methods for . + + + + + Gets the for the current request. + + + + + + + Gets the for the current request. + + + + + + + Processes requests from System.Web as OWIN requests. + + + + + Processes requests using the default OWIN application. + + + + + Initiates an asynchronous call to the HTTP handler. + + + An System.Web.HttpContextBase object that provides references to intrinsic server + objects (for example, Request, Response, Session, and Server) used to service + HTTP requests. + + + The System.AsyncCallback to call when the asynchronous method call is complete. + If callback is null, the delegate is not called. + + + Any extra data needed to process the request. + + + An System.IAsyncResult that contains information about the status of the process. + + + + + Provides an asynchronous process End method when the process ends. + + + An System.IAsyncResult that contains information about the status of the process. + + + + + Gets a value indicating whether another request can use the System.Web.IHttpHandler instance. + + + true. + + + + + Processes a route through an OWIN pipeline. + + + + + Initialize an OwinRouteHandler + + The method to initialize the pipeline that processes requests for the route. + + + + Provides the object that processes the request. + + + An object that processes the request. + + An object that encapsulates information about the request. + + + + Registers the OWIN request processing module at application startup. + + + + + Registers the OWIN request processing module. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to The following errors occurred while attempting to load the app.. + + + + + Looks up a localized string similar to Cannot register for 'OnSendingHeaders' event after response headers have been sent.. + + + + + Looks up a localized string similar to The key '{0}' is already present in the dictionary.. + + + + + Looks up a localized string similar to To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.. + + + + + Looks up a localized string similar to To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.. + + + + + Looks up a localized string similar to The given stage '{0}' is not supported.. + + + + + Looks up a localized string similar to No owin.Environment item was found in the context.. + + + + + Looks up a localized string similar to An exception was thrown while trying to load the client certificate:. + + + + + Looks up a localized string similar to The OWIN entry point threw an exception:. + + + + + Looks up a localized string similar to The IAsyncResult callback for OwinCallHandler threw an exception:. + + + + + Looks up a localized string similar to Failed to register the OWIN module:. + + + + + Looks up a localized string similar to The application threw one or more exceptions when notified of a client disconnect:. + + + + + Looks up a localized string similar to Shutdown detection setup failed:. + + + + + Looks up a localized string similar to One or more exceptions were thrown during app pool shutdown:. + + + + + Looks up a localized string similar to An exception was thrown from a timer callback:. + + + + + Looks up a localized string similar to An exception was thrown while processing the WebSocket:. + + + + + Looks up a localized string similar to Support for WebSockets has been detected.. + + + + + Looks up a localized string similar to No support for WebSockets has been detected.. + + + + + Provides extension methods for registering OWIN applications as System.Web routes. + + + + + Registers a route for the default OWIN application. + + The route collection. + The route path to map to the default OWIN application. + The created route. + + + + Registers a route for a specific OWIN application entry point. + + The OWIN application entry point type. + The route collection. + The route path to map to the given OWIN application. + The OWIN application entry point. + The created route. + + + + Invokes the System.Action startup delegate to build the OWIN application + and then registers a route for it on the given path. + + The route collection. + The route path to map to the given OWIN application. + A System.Action delegate invoked to build the OWIN application. + The created route. + + + + Registers a route for the default OWIN application. + + The route collection. + The given name of the route. + The route path to map to the default OWIN application. + The created route. + + + + Registers a route for a specific OWIN application entry point. + + The OWIN application entry point type. + The route collection. + The given name of the route. + The route path to map to the given OWIN application. + The OWIN application entry point. + The created route. + + + + Invokes the System.Action startup delegate to build the OWIN application + and then registers a route for it on the given path. + + The route collection. + The given name of the route. + The route path to map to the given OWIN application. + A System.Action delegate invoked to build the OWIN application. + The created route. + + + + Provides a way to define routes for an OWIN pipeline. + + The route collection. + The URL pattern for the route. + The method to initialize the pipeline that processes requests for the route. + + + + Provides a way to define routes for an OWIN pipeline. + + The route collection. + The URL pattern for the route. + The values to use if the URL does not contain all the parameters. + The method to initialize the pipeline that processes requests for the route. + + + + Provides a way to define routes for an OWIN pipeline. + + The route collection. + The URL pattern for the route. + The values to use if the URL does not contain all the parameters. + A regular expression that specifies valid values for a URL parameter. + The method to initialize the pipeline that processes requests for the route. + + + + Provides a way to define routes for an OWIN pipeline. + + The route collection. + The URL pattern for the route. + The values to use if the URL does not contain all the parameters. + A regular expression that specifies valid values for a URL parameter. + Custom values that are passed to the route handler, but which are not used to determine whether the route matches a specific URL pattern. These values are passed to the route handler, where they can be used for processing the request. + The method to initialize the pipeline that processes requests for the route. + + + + Provides a way to define routes for an OWIN pipeline. + + The route collection. + The name of the route. + The URL pattern for the route. + The method to initialize the pipeline that processes requests for the route. + + + + Provides a way to define routes for an OWIN pipeline. + + The route collection. + The name of the route. + The URL pattern for the route. + The values to use if the URL does not contain all the parameters. + The method to initialize the pipeline that processes requests for the route. + + + + Provides a way to define routes for an OWIN pipeline. + + The route collection. + The name of the route. + The URL pattern for the route. + The values to use if the URL does not contain all the parameters. + A regular expression that specifies valid values for a URL parameter. + The method to initialize the pipeline that processes requests for the route. + + + + Provides a way to define routes for an OWIN pipeline. + + The route collection. + The name of the route. + The URL pattern for the route. + The values to use if the URL does not contain all the parameters. + A regular expression that specifies valid values for a URL parameter. + Custom values that are passed to the route handler, but which are not used to determine whether the route matches a specific URL pattern. These values are passed to the route handler, where they can be used for processing the request. + The method to initialize the pipeline that processes requests for the route. + + + diff --git a/lib/owin/Microsoft.Owin.XML b/lib/owin/Microsoft.Owin.XML new file mode 100644 index 000000000..c76bbd4ad --- /dev/null +++ b/lib/owin/Microsoft.Owin.XML @@ -0,0 +1,3224 @@ + + + + Microsoft.Owin + + + + + Extension methods for . + + + + + Inserts a middleware into the OWIN pipeline. + + The middleware type + + Any additional arguments for the middleware constructor + + + + + Inserts into the OWIN pipeline a middleware which does not have a next middleware reference. + + + An app that handles all requests + + + + Inserts a middleware into the OWIN pipeline. + + + An app that handles the request or calls the given next Func + + + + + Represents a middleware for executing in-line function middleware. + + + + + Initializes a new instance of the class. + + The pointer to next middleware. + A function that handles all requests. + + + + Initializes a new instance of the class. + + The pointer to next middleware. + A function that handles the request or calls the given next function. + + + + Invokes the handler for processing the request. + + The OWIN context. + The object that represents the request operation. + + + + Contains the parsed form values. + + + + + Accessors for query, forms, etc. + + + + + Accessors for headers, query, forms, etc. + + + + + Get the associated value from the collection. Multiple values will be merged. + Returns null if the key is not present. + + + + + + + Get the associated values from the collection in their original format. + Returns null if the key is not present. + + + + + + + Get the associated value from the collection. Multiple values will be merged. + Returns null if the key is not present. + + + + + + + Create a new wrapper + + + + + + Get the associated value from the collection. Multiple values will be merged. + Returns null if the key is not present. + + + + + + + Get the associated values from the collection in their original format. + Returns null if the key is not present. + + + + + + + + + + + + + + + + + + + Get the associated value from the collection. Multiple values will be merged. + Returns null if the key is not present. + + + + + + + Contains the parsed form values. + + + + + Initializes a new instance of the class. + + The store for the form. + + + + Represents a wrapper for owin.RequestHeaders and owin.ResponseHeaders. + + + + + Represents a wrapper for owin.RequestHeaders and owin.ResponseHeaders. + + + + + Get the associated values from the collection separated into individual values. + Quoted values will not be split, and the quotes will be removed. + + The header name. + the associated values from the collection separated into individual values, or null if the key is not present. + + + + Add a new value. Appends to the header if already present + + The header name. + The header value. + + + + Add new values. Each item remains a separate array entry. + + The header name. + The header values. + + + + Quotes any values containing comas, and then coma joins all of the values with any existing values. + + The header name. + The header values. + + + + Sets a specific header value. + + The header name. + The header value. + + + + Sets the specified header values without modification. + + The header name. + The header values. + + + + Quotes any values containing comas, and then coma joins all of the values. + + The header name. + The header values. + + + + Get or sets the associated value from the collection as a single string. + + The header name. + the associated value from the collection as a single string or null if the key is not present. + + + + Initializes a new instance of the class. + + The underlying data store. + + + + Returns an enumerator that iterates through a collection. + + An object that can be used to iterate through the collection. + + + + Returns an enumerator that iterates through a collection. + + An object that can be used to iterate through the collection. + + + + Get the associated value from the collection as a single string. + + The header name. + the associated value from the collection as a single string or null if the key is not present. + + + + Get the associated values from the collection without modification. + + The header name. + the associated value from the collection without modification, or null if the key is not present. + + + + Get the associated values from the collection separated into individual values. + Quoted values will not be split, and the quotes will be removed. + + The header name. + the associated values from the collection separated into individual values, or null if the key is not present. + + + + Add a new value. Appends to the header if already present + + The header name. + The header value. + + + + Add new values. Each item remains a separate array entry. + + The header name. + The header values. + + + + Quotes any values containing comas, and then coma joins all of the values with any existing values. + + The header name. + The header values. + + + + Sets a specific header value. + + The header name. + The header value. + + + + Sets the specified header values without modification. + + The header name. + The header values. + + + + Quotes any values containing comas, and then coma joins all of the values. + + The header name. + The header values. + + + + Adds the given header and values to the collection. + + The header name. + The header values. + + + + Determines whether the contains a specific key. + + The key. + true if the contains a specific key; otherwise, false. + + + + Removes the given header from the collection. + + The header name. + true if the specified object was removed from the collection; otherwise, false. + + + + Retrieves a value from the dictionary. + + The header name. + The value. + true if the contains the key; otherwise, false. + + + + Adds a new list of items to the collection. + + The item to add. + + + + Clears the entire list of objects. + + + + + Returns a value indicating whether the specified object occurs within this collection. + + The item. + true if the specified object occurs within this collection; otherwise, false. + + + + Copies the elements to a one-dimensional Array instance at the specified index. + + The one-dimensional Array that is the destination of the specified objects copied from the . + The zero-based index in at which copying begins. + + + + Removes the given item from the the collection. + + The item. + true if the specified object was removed from the collection; otherwise, false. + + + + Gets an that contains the keys in the ;. + + An that contains the keys in the . + + + + + + + + + Gets the number of elements contained in the ;. + + The number of elements contained in the . + + + + Gets a value that indicates whether the is in read-only mode. + + true if the is in read-only mode; otherwise, false. + + + + Get or sets the associated value from the collection as a single string. + + The header name. + the associated value from the collection as a single string or null if the key is not present. + + + + Throws KeyNotFoundException if the key is not present. + + The header name. + + + + + Represents the host portion of a Uri can be used to construct Uri's properly formatted and encoded for use in + HTTP headers. + + + + + Creates a new HostString without modification. The value should be Unicode rather than punycode, and may have a port. + IPv4 and IPv6 addresses are also allowed, and also may have ports. + + + + + + Returns the value as normalized by ToUriComponent(). + + + + + + Returns the value properly formatted and encoded for use in a URI in a HTTP header. + Any Unicode is converted to punycode. IPv6 addresses will have brackets added if they are missing. + + + + + + Creates a new HostString from the given uri component. + Any punycode will be converted to Unicode. + + + + + + + Creates a new HostString from the host and port of the give Uri instance. + Punycode will be converted to Unicode. + + + + + + + Compares the equality of the Value property, ignoring case. + + + + + + + Compares against the given object only if it is a HostString. + + + + + + + Gets a hash code for the value. + + + + + + Compares the two instances for equality. + + + + + + + + Compares the two instances for inequality. + + + + + + + + Returns the original value from the constructor. + + + + + This handles cookies that are limited by per cookie length. It breaks down long cookies for responses, and reassembles them + from requests. + + + + + Get the reassembled cookie. Non chunked cookies are returned normally. + Cookies with missing chunks just have their "chunks:XX" header returned. + + + + The reassembled cookie, if any, or null. + + + + Appends a new response cookie to the Set-Cookie header. If the cookie is larger than the given size limit + then it will be broken down into multiple cookies as follows: + Set-Cookie: CookieName=chunks:3; path=/ + Set-Cookie: CookieNameC1=Segment1; path=/ + Set-Cookie: CookieNameC2=Segment2; path=/ + Set-Cookie: CookieNameC3=Segment3; path=/ + + + + + + + + + Deletes the cookie with the given key by setting an expired state. If a matching chunked cookie exists on + the request, delete each chunk. + + + + + + + + The maximum size of cookie to send back to the client. If a cookie exceeds this size it will be broken down into multiple + cookies. Set this value to null to disable this behavior. The default is 4090 characters, which is supported by all + common browsers. + + Note that browsers may also have limits on the total size of all cookies per domain, and on the number of cookies per domain. + + + + + Throw if not all chunks of a cookie are available on a request for re-assembly. + + + + + This wraps OWIN environment dictionary and provides strongly typed accessors. + + + + + Gets a value from the OWIN environment, or returns default(T) if not present. + + The type of the value. + The key of the value to get. + The value with the specified key or the default(T) if not present. + + + + Sets the given key and value in the OWIN environment. + + The type of the value. + The key of the value to set. + The value to set. + This instance. + + + + Gets a wrapper exposing request specific properties. + + A wrapper exposing request specific properties. + + + + Gets a wrapper exposing response specific properties. + + A wrapper exposing response specific properties. + + + + Gets the Authentication middleware functionality available on the current request. + + The authentication middleware functionality available on the current request. + + + + Gets the OWIN environment. + + The OWIN environment. + + + + Gets or sets the host.TraceOutput environment value. + + The host.TraceOutput TextWriter. + + + + This wraps OWIN environment dictionary and provides strongly typed accessors. + + + + + Asynchronously reads and parses the request body as a form. + + The parsed form data. + + + + Gets a value from the OWIN environment, or returns default(T) if not present. + + The type of the value. + The key of the value to get. + The value with the specified key or the default(T) if not present. + + + + Sets the given key and value in the OWIN environment. + + The type of the value. + The key of the value to set. + The value to set. + This instance. + + + + Gets the OWIN environment. + + The OWIN environment. + + + + Gets the request context. + + The request context. + + + + Gets or set the HTTP method. + + The HTTP method. + + + + Gets or set the HTTP request scheme from owin.RequestScheme. + + The HTTP request scheme from owin.RequestScheme. + + + + Returns true if the owin.RequestScheme is https. + + true if this request is using https; otherwise, false. + + + + Gets or set the Host header. May include the port. + + The Host header. + + + + Gets or set the owin.RequestPathBase. + + The owin.RequestPathBase. + + + + Gets or set the request path from owin.RequestPath. + + The request path from owin.RequestPath. + + + + Gets or set the query string from owin.RequestQueryString. + + The query string from owin.RequestQueryString. + + + + Gets the query value collection parsed from owin.RequestQueryString. + + The query value collection parsed from owin.RequestQueryString. + + + + Gets the uniform resource identifier (URI) associated with the request. + + The uniform resource identifier (URI) associated with the request. + + + + Gets or set the owin.RequestProtocol. + + The owin.RequestProtocol. + + + + Gets the request headers. + + The request headers. + + + + Gets the collection of Cookies for this request. + + The collection of Cookies for this request. + + + + Gets or sets the Content-Type header. + + The Content-Type header. + + + + Gets or sets the Cache-Control header. + + The Cache-Control header. + + + + Gets or sets the Media-Type header. + + The Media-Type header. + + + + Gets or set the Accept header. + + The Accept header. + + + + Gets or set the owin.RequestBody Stream. + + The owin.RequestBody Stream. + + + + Gets or sets the cancellation token for the request. + + The cancellation token for the request. + + + + Gets or set the server.LocalIpAddress. + + The server.LocalIpAddress. + + + + Gets or set the server.LocalPort. + + The server.LocalPort. + + + + Gets or set the server.RemoteIpAddress. + + The server.RemoteIpAddress. + + + + Gets or set the server.RemotePort. + + The server.RemotePort. + + + + Gets or set the server.User. + + The server.User. + + + + This wraps OWIN environment dictionary and provides strongly typed accessors. + + + + + Registers for an event that fires when the response headers are sent. + + The callback method. + The callback state. + + + + Sets a 302 response status code and the Location header. + + The location where to redirect the client. + + + + Writes the given text to the response body stream using UTF-8. + + The response data. + + + + Writes the given bytes to the response body stream. + + The response data. + + + + Writes the given bytes to the response body stream. + + The response data. + The zero-based byte offset in the parameter at which to begin copying bytes. + The number of bytes to write. + + + + Asynchronously writes the given text to the response body stream using UTF-8. + + The response data. + A Task tracking the state of the write operation. + + + + Asynchronously writes the given text to the response body stream using UTF-8. + + The response data. + A token used to indicate cancellation. + A Task tracking the state of the write operation. + + + + Asynchronously writes the given bytes to the response body stream. + + The response data. + A Task tracking the state of the write operation. + + + + Asynchronously writes the given bytes to the response body stream. + + The response data. + A token used to indicate cancellation. + A Task tracking the state of the write operation. + + + + Asynchronously writes the given bytes to the response body stream. + + The response data. + The zero-based byte offset in the parameter at which to begin copying bytes. + The number of bytes to write. + A token used to indicate cancellation. + A Task tracking the state of the write operation. + + + + Gets a value from the OWIN environment, or returns default(T) if not present. + + The type of the value. + The key of the value to get. + The value with the specified key or the default(T) if not present. + + + + Sets the given key and value in the OWIN environment. + + The type of the value. + The key of the value to set. + The value to set. + This instance. + + + + Gets the OWIN environment. + + The OWIN environment. + + + + Gets the request context. + + The request context. + + + + Gets or sets the optional owin.ResponseStatusCode. + + The optional owin.ResponseStatusCode, or 200 if not set. + + + + Gets or sets the the optional owin.ResponseReasonPhrase. + + The the optional owin.ResponseReasonPhrase. + + + + Gets or sets the owin.ResponseProtocol. + + The owin.ResponseProtocol. + + + + Gets the response header collection. + + The response header collection. + + + + Gets a collection used to manipulate the Set-Cookie header. + + A collection used to manipulate the Set-Cookie header. + + + + Gets or sets the Content-Length header. + + The Content-Length header. + + + + Gets or sets the Content-Type header. + + The Content-Type header. + + + + Gets or sets the Expires header. + + The Expires header. + + + + Gets or sets the E-Tag header. + + The E-Tag header. + + + + Gets or sets the owin.ResponseBody Stream. + + The owin.ResponseBody Stream. + + + + Used to mark which class in an assembly should be used for automatic startup. + + + + + Initializes a new instance of the class + + The startup class + + + + Initializes a new instance of the class + + A non-default configuration, e.g. staging. + The startup class + + + + Initializes a new instance of the class + + The startup class + Specifies which method to call + + + + Initializes a new instance of the class + + A non-default configuration, e.g. staging. + The startup class + Specifies which method to call + + + + A non-default configuration if any. e.g. Staging. + + + + + The startup class + + + + + The name of the configuration method + + + + + An ordered list of known Asp.Net integrated pipeline stages. More details on the ASP.NET integrated pipeline can be found at http://msdn.microsoft.com/en-us/library/system.web.httpapplication.aspx + + + + + Corresponds to the AuthenticateRequest stage of the ASP.NET integrated pipeline. + + + + + Corresponds to the PostAuthenticateRequest stage of the ASP.NET integrated pipeline. + + + + + Corresponds to the AuthorizeRequest stage of the ASP.NET integrated pipeline. + + + + + Corresponds to the PostAuthorizeRequest stage of the ASP.NET integrated pipeline. + + + + + Corresponds to the ResolveRequestCache stage of the ASP.NET integrated pipeline. + + + + + Corresponds to the PostResolveRequestCache stage of the ASP.NET integrated pipeline. + + + + + Corresponds to the MapRequestHandler stage of the ASP.NET integrated pipeline. + + + + + Corresponds to the PostMapRequestHandler stage of the ASP.NET integrated pipeline. + + + + + Corresponds to the AcquireRequestState stage of the ASP.NET integrated pipeline. + + + + + Corresponds to the PostAcquireRequestState stage of the ASP.NET integrated pipeline. + + + + + Corresponds to the PreRequestHandlerExecute stage of the ASP.NET integrated pipeline. + + + + + Extension methods for the MapMiddleware + + + + + If the request path starts with the given pathMatch, execute the app configured via configuration parameter instead of + continuing to the next component in the pipeline. + + + The path to match + The branch to take for positive path matches + + + + + If the request path starts with the given pathMatch, execute the app configured via configuration parameter instead of + continuing to the next component in the pipeline. + + + The path to match + The branch to take for positive path matches + + + + + Used to create path based branches in your application pipeline. + The owin.RequestPathBase is not included in the evaluation, only owin.RequestPath. + Matching paths have the matching piece removed from owin.RequestPath and added to the owin.RequestPathBase. + + + + + Initializes a new instance of the class + + The normal pipeline taken for a negative match + + + + + Process an individual request. + + + + + + + Options for the Map middleware + + + + + The path to match + + + + + The branch taken for a positive match + + + + + Extension methods for the MapWhenMiddleware + + + + + Branches the request pipeline based on the result of the given predicate. + + + Invoked with the request environment to determine if the branch should be taken + Configures a branch to take + + + + + Branches the request pipeline based on the async result of the given predicate. + + + Invoked asynchronously with the request environment to determine if the branch should be taken + Configures a branch to take + + + + + Determines if the request should take a specific branch of the pipeline by passing the environment + to a user defined callback. + + + + + Initializes a new instance of the class + + The normal application pipeline + + + + + Process an individual request. + + + + + + + Options for the MapWhen middleware + + + + + The user callback that determines if the branch should be taken + + + + + The async user callback that determines if the branch should be taken + + + + + The branch taken for a positive match + + + + + This wraps OWIN environment dictionary and provides strongly typed accessors. + + + + + Create a new context with only request and response header collections. + + + + + Create a new wrapper. + + OWIN environment dictionary which stores state information about the request, response and relevant server state. + + + + Gets a value from the OWIN environment, or returns default(T) if not present. + + The type of the value. + The key of the value to get. + The value with the specified key or the default(T) if not present. + + + + Sets the given key and value in the OWIN environment. + + The type of the value. + The key of the value to set. + The value to set. + This instance. + + + + Gets a wrapper exposing request specific properties. + + A wrapper exposing request specific properties. + + + + Gets a wrapper exposing response specific properties. + + A wrapper exposing response specific properties. + + + + Gets the Authentication middleware functionality available on the current request. + + The authentication middleware functionality available on the current request. + + + + Gets the OWIN environment. + + The OWIN environment. + + + + Gets or sets the host.TraceOutput environment value. + + The host.TraceOutput TextWriter. + + + + Provides correct escaping for Path and PathBase values when needed to reconstruct a request or redirect URI string + + + + + Represents the empty path. This field is read-only. + + + + + Initialize the path string with a given value. This value must be in un-escaped format. Use + PathString.FromUriComponent(value) if you have a path value which is in an escaped format. + + The unescaped path to be assigned to the Value property. + + + + Provides the path string escaped in a way which is correct for combining into the URI representation. + + The escaped path value + + + + Provides the path string escaped in a way which is correct for combining into the URI representation. + + The escaped path value + + + + Returns an PathString given the path as it is escaped in the URI format. The string MUST NOT contain any + value that is not a path. + + The escaped path as it appears in the URI format. + The resulting PathString + + + + Returns an PathString given the path as from a Uri object. Relative Uri objects are not supported. + + The Uri object + The resulting PathString + + + + Checks if this instance starts with or exactly matches the other instance. Only full segments are matched. + + + + + + + Checks if this instance starts with or exactly matches the other instance. Only full segments are matched. + + + Any remaining segments from this instance not included in the other instance. + + + + + Adds two PathString instances into a combined PathString value. + + The combined PathString value + + + + Combines a PathString and QueryString into the joined URI formatted string value. + + The joined URI formatted string value + + + + Compares this PathString value to another value. The default comparison is StringComparison.OrdinalIgnoreCase. + + The second PathString for comparison. + True if both PathString values are equal + + + + Compares this PathString value to another value using a specific StringComparison type + + The second PathString for comparison + The StringComparison type to use + True if both PathString values are equal + + + + Compares this PathString value to another value. The default comparison is StringComparison.OrdinalIgnoreCase. + + The second PathString for comparison. + True if both PathString values are equal + + + + Returns the hash code for the PathString value. The hash code is provided by the OrdinalIgnoreCase implementation. + + The hash code + + + + Operator call through to Equals + + The left parameter + The right parameter + True if both PathString values are equal + + + + Operator call through to Equals + + The left parameter + The right parameter + True if both PathString values are not equal + + + + Operator call through to Add + + The left parameter + The right parameter + The PathString combination of both values + + + + Operator call through to Add + + The left parameter + The right parameter + The PathString combination of both values + + + + The unescaped path value + + + + + True if the path is not empty + + + + + Provides correct handling for QueryString value when needed to reconstruct a request or redirect URI string + + + + + Represents the empty query string. This field is read-only. + + + + + Initialize the query string with a given value. This value must be in escaped and delimited format without + a leading '?' character. + + The query string to be assigned to the Value property. + + + + Initialize a query string with a single given parameter name and value. The value is + + The unencoded parameter name + The unencoded parameter value + + + + Provides the query string escaped in a way which is correct for combining into the URI representation. + A leading '?' character will be prepended unless the Value is null or empty. Characters which are potentially + dangerous are escaped. + + The query string value + + + + Provides the query string escaped in a way which is correct for combining into the URI representation. + A leading '?' character will be prepended unless the Value is null or empty. Characters which are potentially + dangerous are escaped. + + The query string value + + + + Returns an QueryString given the query as it is escaped in the URI format. The string MUST NOT contain any + value that is not a query. + + The escaped query as it appears in the URI format. + The resulting QueryString + + + + Returns an QueryString given the query as from a Uri object. Relative Uri objects are not supported. + + The Uri object + The resulting QueryString + + + + Indicates whether the current instance is equal to the other instance. + + + + + + + Indicates whether the current instance is equal to the other instance. + + + + + + + Returns the hash code for this instance. + + + + + + Compares the two instances for equality. + + + + + + + + Compares the two instances for inequality. + + + + + + + + The escaped query string without the leading '?' character + + + + + True if the query string is not empty + + + + + A wrapper for the request Cookie header + + + + + Create a new wrapper + + + + + + + + + + + + + + + + + + Returns null rather than throwing KeyNotFoundException + + + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to Conversion delegate must take one parameter.. + + + + + Looks up a localized string similar to The cookie key and options are larger than ChunksSize, leaving no room for data.. + + + + + Looks up a localized string similar to The chunked cookie is incomplete. Only {0} of the expected {1} chunks were found, totaling {2} characters. A client size limit may have been exceeded.. + + + + + Looks up a localized string similar to The type '{0}' does not match any known middleware pattern.. + + + + + Looks up a localized string similar to The OWIN key 'server.OnSendingHeaders' is not available for this request.. + + + + + Looks up a localized string similar to The class '{0}' does not have a constructor taking {1} arguments.. + + + + + Looks up a localized string similar to No conversion available between {0} and {1}.. + + + + + Looks up a localized string similar to The path must not end with a '/'. + + + + + Looks up a localized string similar to The path must start with a '/' followed by one or more characters.. + + + + + Looks up a localized string similar to The path is required. + + + + + Looks up a localized string similar to The query string must start with a '?' unless null or empty.. + + + + + A standard implementation of IAppBuilder + + + + + Initializes a new instance of the the type. + + + + + + + + + + + + Adds a middleware node to the OWIN function pipeline. The middleware are + invoked in the order they are added: the first middleware passed to Use will + be the outermost function, and the last middleware passed to Use will be the + innermost. + + + The middleware parameter determines which behavior is being chained into the + pipeline. + + If the middleware given to Use is a Delegate, then it will be invoked with the "next app" in + the chain as the first parameter. If the delegate takes more than the single argument, + then the additional values must be provided to Use in the args array. + + If the middleware given to Use is a Type, then the public constructor will be + invoked with the "next app" in the chain as the first parameter. The resulting object + must have a public Invoke method. If the object has constructors which take more than + the single "next app" argument, then additional values may be provided in the args array. + + + Any additional args passed to Use will be passed as additional values, following the "next app" + parameter, when the OWIN call pipeline is build. + + They are passed as additional parameters if the middleware parameter is a Delegate, or as additional + constructor arguments if the middle parameter is a Type. + + + The IAppBuilder itself is returned. This enables you to chain your use statements together. + + + + + The New method creates a new instance of an IAppBuilder. This is needed to create + a tree structure in your processing, rather than a linear pipeline. The new instance share the + same Properties, but will be created with a new, empty middleware list. + + To create a tangent pipeline you would first call New, followed by several calls to Use on + the new builder, ending with a call to Build on the new builder. The return value from Build + will be the entry-point to your tangent pipeline. This entry-point may now be added to the + main pipeline as an argument to a switching middleware, which will either call the tangent + pipeline or the "next app", based on something in the request. + + That said - all of that work is typically hidden by a middleware like Map, which will do that + for you. + + The new instance of the IAppBuilder implementation + + + + The Build is called at the point when all of the middleware should be chained + together. This is typically done by the hosting component which created the app builder, + and does not need to be called by the startup method if the IAppBuilder is passed in. + + + The Type argument indicates which calling convention should be returned, and + is typically typeof() for the OWIN + calling convention. + + + Returns an instance of the pipeline's entry point. This object may be safely cast to the + type which was provided + + + + + Contains arbitrary properties which may added, examined, and modified by + components during the startup sequence. + + Returns . + + + + Simple object used by AppBuilder as seed OWIN callable if the + builder.Properties["builder.DefaultApp"] is not set + + + + + Abstracts the system clock to facilitate testing. + + + + + Retrieves the current system time in UTC. + + + + + Provides access to the normal system clock. + + + + + Retrieves the current system time in UTC. + + + + + Response generation utilities. + + + + + Append the given query to the uri. + + The base uri. + The query string to append, if any. + The combine result. + + + + Append the given query key and value to the uri. + + The base uri. + The name of the query key. + The query value. + The combine result. + + + + Append the given query keys and values to the uri. + + The base uri. + A collection of name value query pairs to append. + The combine result. + + + + A wrapper for the response Set-Cookie header + + + + + Create a new wrapper + + + + + + Add a new cookie and value + + + + + + + Add a new cookie + + + + + + + + Sets an expired cookie + + + + + + Sets an expired cookie + + + + + + + Acts as the return value from calls to the IAuthenticationManager's AuthenticeAsync methods. + + + + + Create an instance of the result object + + Assigned to Identity. May be null. + Assigned to Properties. Contains extra information carried along with the identity. + Assigned to Description. Contains information describing the authentication provider. + + + + Contains the claims that were authenticated by the given AuthenticationType. If the authentication + type was not successful the Identity property will be null. + + + + + Contains extra values that were provided with the original SignIn call. + + + + + Contains description properties for the middleware authentication type in general. Does not + vary per request. + + + + + Contains information describing an authentication provider. + + + + + Initializes a new instance of the class + + + + + Initializes a new instance of the class + + + + + + Contains metadata about the authentication provider. + + + + + Gets or sets the name used to reference the authentication middleware instance. + + + + + Gets or sets the display name for the authentication provider. + + + + + Extension methods used to indicate at which stage in the integrated pipeline prior middleware should run. + + + + + Call after other middleware to specify when they should run in the integrated pipeline. + + The IAppBuilder. + The name of the integrated pipeline in which to run. + The original IAppBuilder for chaining. + + + + Call after other middleware to specify when they should run in the integrated pipeline. + + The IAppBuilder. + The stage of the integrated pipeline in which to run. + The original IAppBuilder for chaining. + + + + Logging extension methods for IAppBuilder. + + + + + Sets the server.LoggerFactory in the Properties collection. + + + + + + + Retrieves the server.LoggerFactory from the Properties collection. + + + + + + + Creates a new ILogger instance from the server.LoggerFactory in the Properties collection. + + + + + + + + Creates a new ILogger instance from the server.LoggerFactory in the Properties collection. + + + + + + + + Creates a new ILogger instance from the server.LoggerFactory in the Properties collection. + + + + + + + + Used to create logger instances of the given name. + + + + + Creates a new ILogger instance of the given name. + + + + + + + A generic interface for logging. + + + + + Aggregates most logging patterns to a single method. This must be compatible with the Func representation in the OWIN environment. + + To check IsEnabled call WriteCore with only TraceEventType and check the return value, no event will be written. + + + + + + + + + + + Contains the parts of an address. + + + + + Initializes a new instance. + + + + + + Initializes a new with the given parts. + + The scheme. + The host. + The port. + The path. + + + + Creates a new + + A new + + + + Determines whether the specified object is equal to the current object. + + The other object. + true if the specified object is equal to the current object; otherwise, false. + + + + Determines whether the specified object is equal to the current object. + + The other object. + true if the specified object is equal to the current object; otherwise, false. + + + + Returns the hash code for this instance. + + The hash code for this instance. + + + + Determines whether two specified instances of are equal. + + The first object to compare. + The second object to compare. + true if left and right represent the same address; otherwise, false. + + + + Determines whether two specified instances of are not equal. + + The first object to compare. + The second object to compare. + true if left and right do not represent the same address; otherwise, false. + + + + Gets a specified key and value from the underlying dictionary. + + + The key. + + + + + Sets a specified key and value in the underlying dictionary. + + The key. + The value. + + + + + Gets the internal dictionary for this collection. + + The internal dictionary for this collection. + + + + The uri scheme. + + + + + The uri host. + + + + + The uri port. + + + + + The uri path. + + + + + Wraps the host.Addresses list. + + + + + Initializes a new instance of the class. + + The address list to set to the collection. + + + + Adds the specified address to the collection. + + The address to add to the collection. + + + + Gets the enumerator that iterates through the collection. + + The enumerator that can be used to iterate through the collection. + + + + Gets the enumerator that iterates through the collection. + + The enumerator that can be used to iterate through the collection. + + + + Creates a new empty instance of . + + A new empty instance of . + + + + Determines whether the current collection is equal to the specified collection. + + The other collection to compare to the current collection. + true if current collection is equal to the specified collection; otherwise, false. + + + + Determines whether the current collection is equal to the specified object. + + The object to compare to the current collection. + true if current collection is equal to the specified object; otherwise, false. + + + + Gets the hash code for this instance. + + The hash code for this instance. + + + + Determines whether the first collection is equal to the second collection. + + The first collection to compare. + The second collection to compare. + true if both collections are equal; otherwise, false. + + + + Determines whether the first collection is not equal to the second collection. + + The first collection to compare. + The second collection to compare. + true if both collections are not equal; otherwise, false. + + + + Gets the underlying address list. + + The underlying address list. + + + + Gets the number of elements in the collection. + + The number of elements in the collection. + + + + Gets the item with the specified index from the collection. + + The index. + The item with the specified index. + + + + A wrapper for the IDictionary. + + + + + Initializes a new instance of the class. + + + + + + Determines whether the current AppProperties is equal to the specified AppProperties. + + The other AppProperties to compare with the current instance. + true if the current AppProperties is equal to the specified AppProperties; otherwise, false. + + + + Determines whether the current AppProperties is equal to the specified object. + + The object to compare with the current instance. + true if the current AppProperties is equal to the specified object; otherwise, false. + + + + Returns the hash code for this instance. + + The hash code for this instance. + + + + Determines whether the first AppPProperties is equal to the second AppProperties. + + The first AppPropeties to compare. + The second AppPropeties to compare. + true if both AppProperties are equal; otherwise, false. + + + + Determines whether the first AppPProperties is not equal to the second AppProperties. + + The first AppPropeties to compare. + The second AppPropeties to compare. + true if both AppProperties are not equal; otherwise, false. + + + + Gets the value from the dictionary with the specified key. + + The type of the value. + The key of the value to get. + The value with the specified key. + + + + Sets the value with the specified key. + + The key of the value to set. + The value to set. + This instance. + + + + Gets or sets the string value for “owin.Version”. + + The string value for “owin.Version”. + + + + Gets or sets the function delegate for “builder.DefaultApp”. + + The function delegate for “builder.DefaultApp”. + + + + Gets or sets the action delegate for “builder.AddSignatureConversion”. + + The action delegate for “builder.AddSignatureConversion”. + + + + Gets or sets the string value for “host.AppName”. + + The string value for “host.AppName”. + + + + Gets or sets the text writer for “host.TraceOutput”. + + The text writer for “host.TraceOutput”. + + + + Gets or sets the cancellation token for “host.OnAppDisposing”. + + The cancellation token for “host.OnAppDisposing”. + + + + Gets or sets the address collection for “host.Addresses”. + + The address collection for “host.Addresses”. + + + + Gets or sets the list of “server.Capabilities”. + + The list of “server.Capabilities”. + + + + Gets the underlying dictionary for this instance. + + The underlying dictionary for this instance. + + + + Represents the capabilities for the builder properties. + + + + + Initializes a new instance of the class. + + + + + + Initializes a new instance of the class. + + A new instance of the class. + + + + Determines whether the current Capabilities instance is equal to the specified Capabilities. + + The other Capabilities to compare with the current instance. + true if the specified object is equal to the current object; otherwise, false. + + + + Determines whether the current Capabilities is equal to the specified object. + + The object to compare with the current instance. + true if the current Capabilities is equal to the specified object; otherwise, false. + + + + Returns the hash code for this instance. + + The hash code for this instance. + + + + Determines whether two specified instances of are equal. + + The first object to compare. + The second object to compare. + true if the two specified instances of are equal; otherwise, false. + + + + Determines whether two specified instances of are not equal. + + The first object to compare. + The second object to compare. + true if the two specified instances of are not equal; otherwise, false. + + + + Gets the value from the dictionary with the specified key. + + The type of the value. + The key of the value to get. + The value with the specified key. + + + + Sets the given key and value in the underlying dictionary. + + The key of the value to set. + The value to set. + This instance. + + + + The underling IDictionary + + + + + Gets or sets the string value for "sendfile.Version" + + the string value for "sendfile.Version" + + + + Gets or sets the websocket version. + + The websocket version. + + + + Options used to create a new cookie. + + + + + Creates a default cookie with a path of '/'. + + + + + Gets or sets the domain to associate the cookie with. + + The domain to associate the cookie with. + + + + Gets or sets the cookie path. + + The cookie path. + + + + Gets or sets the expiration date and time for the cookie. + + The expiration date and time for the cookie. + + + + Gets or sets a value that indicates whether to transmit the cookie using Secure Sockets Layer (SSL)—that is, over HTTPS only. + + true to transmit the cookie only over an SSL connection (HTTPS); otherwise, false. + + + + Gets or sets a value that indicates whether a cookie is accessible by client-side script. + + true if a cookie is accessible by client-side script; otherwise, false. + + + + Provides a default ILoggerFactory. + + + + + Provides a default ILoggerFactory based on System.Diagnostics.TraceSorce. + + + + + Extension methods for IAppBuilder. + + + + + The Build is called at the point when all of the middleware should be chained + together. May be called to build pipeline branches. + + + The request processing entry point for this section of the pipeline. + + + + The Build is called at the point when all of the middleware should be chained + together. May be called to build pipeline branches. + + The application signature. + + The request processing entry point for this section of the pipeline. + + + + Adds converters for adapting between disparate application signatures. + + + + + + + Adds converters for adapting between disparate application signatures. + + + + + + + + + Provides helper methods for processing requests. + + + + + Parses an HTTP form body. + + The HTTP form body to parse. + The object containing the parsed HTTP form body. + + + + Converts between an OwinMiddlware and an . + + + + + An abstract base class for a standard middleware pattern. + + + + + Instantiates the middleware with an optional pointer to the next component. + + + + + + Process an individual request. + + + + + + + The optional next component. + + + + + + + + + + + + + + + + + + Transitions between and OwinMiddleware. + + + + + + + + + + + + + OWIN environment dictionary which stores state information about the request, response and relevant server state. + + + + + Adds adapters between and OwinMiddleware. + + + + + Adds adapters between and OwinMiddleware. + + + + + + This wraps OWIN environment dictionary and provides strongly typed accessors. + + + + + Create a new context with only request and response header collections. + + + + + Create a new environment wrapper exposing request properties. + + OWIN environment dictionary which stores state information about the request, response and relevant server state. + + + + Asynchronously reads and parses the request body as a form. + + The parsed form data. + + + + Gets a value from the OWIN environment, or returns default(T) if not present. + + The type of the value. + The key of the value to get. + The value with the specified key or the default(T) if not present. + + + + Sets the given key and value in the OWIN environment. + + The type of the value. + The key of the value to set. + The value to set. + This instance. + + + + Gets the OWIN environment. + + The OWIN environment. + + + + Gets the request context. + + The request context. + + + + Gets or set the HTTP method. + + The HTTP method. + + + + Gets or set the HTTP request scheme from owin.RequestScheme. + + The HTTP request scheme from owin.RequestScheme. + + + + Returns true if the owin.RequestScheme is https. + + true if this request is using https; otherwise, false. + + + + Gets or set the Host header. May include the port. + + The Host header. + + + + Gets or set the owin.RequestPathBase. + + The owin.RequestPathBase. + + + + Gets or set the request path from owin.RequestPath. + + The request path from owin.RequestPath. + + + + Gets or set the query string from owin.RequestQueryString. + + The query string from owin.RequestQueryString. + + + + Gets the query value collection parsed from owin.RequestQueryString. + + The query value collection parsed from owin.RequestQueryString. + + + + Gets the uniform resource identifier (URI) associated with the request. + + The uniform resource identifier (URI) associated with the request. + + + + Gets or set the owin.RequestProtocol. + + The owin.RequestProtocol. + + + + Gets the request headers. + + The request headers. + + + + Gets the collection of Cookies for this request. + + The collection of Cookies for this request. + + + + Gets or sets the Content-Type header. + + The Content-Type header. + + + + Gets or sets the Cache-Control header. + + The Cache-Control header. + + + + Gets or sets the Media-Type header. + + The Media-Type header. + + + + Gets or set the Accept header. + + The Accept header. + + + + Gets or set the owin.RequestBody Stream. + + The owin.RequestBody Stream. + + + + Gets or sets the cancellation token for the request. + + The cancellation token for the request. + + + + Gets or set the server.LocalIpAddress. + + The server.LocalIpAddress. + + + + Gets or set the server.LocalPort. + + The server.LocalPort. + + + + Gets or set the server.RemoteIpAddress. + + The server.RemoteIpAddress. + + + + Gets or set the server.RemotePort. + + The server.RemotePort. + + + + Gets or set the server.User. + + The server.User. + + + + This wraps OWIN environment dictionary and provides strongly typed accessors. + + + + + Create a new context with only request and response header collections. + + + + + Creates a new environment wrapper exposing response properties. + + OWIN environment dictionary which stores state information about the request, response and relevant server state. + + + + Registers for an event that fires when the response headers are sent. + + The callback method. + The callback state. + + + + Sets a 302 response status code and the Location header. + + The location where to redirect the client. + + + + Writes the given text to the response body stream using UTF-8. + + The response data. + + + + Writes the given bytes to the response body stream. + + The response data. + + + + Writes the given bytes to the response body stream. + + The response data. + The zero-based byte offset in the parameter at which to begin copying bytes. + The number of bytes to write. + + + + Asynchronously writes the given text to the response body stream using UTF-8. + + The response data. + A Task tracking the state of the write operation. + + + + Asynchronously writes the given text to the response body stream using UTF-8. + + The response data. + A token used to indicate cancellation. + A Task tracking the state of the write operation. + + + + Asynchronously writes the given bytes to the response body stream. + + The response data. + A Task tracking the state of the write operation. + + + + Asynchronously writes the given bytes to the response body stream. + + The response data. + A token used to indicate cancellation. + A Task tracking the state of the write operation. + + + + Asynchronously writes the given bytes to the response body stream. + + The response data. + The zero-based byte offset in the parameter at which to begin copying bytes. + The number of bytes to write. + A token used to indicate cancellation. + A Task tracking the state of the write operation. + + + + Gets a value from the OWIN environment, or returns default(T) if not present. + + The type of the value. + The key of the value to get. + The value with the specified key or the default(T) if not present. + + + + Sets the given key and value in the OWIN environment. + + The type of the value. + The key of the value to set. + The value to set. + This instance. + + + + Gets the OWIN environment. + + The OWIN environment. + + + + Gets the request context. + + The request context. + + + + Gets or sets the optional owin.ResponseStatusCode. + + The optional owin.ResponseStatusCode, or 200 if not set. + + + + Gets or sets the the optional owin.ResponseReasonPhrase. + + The the optional owin.ResponseReasonPhrase. + + + + Gets or sets the owin.ResponseProtocol. + + The owin.ResponseProtocol. + + + + Gets the response header collection. + + The response header collection. + + + + Gets a collection used to manipulate the Set-Cookie header. + + A collection used to manipulate the Set-Cookie header. + + + + Gets or sets the Content-Length header. + + The Content-Length header. + + + + Gets or sets the Content-Type header. + + The Content-Type header. + + + + Gets or sets the Expires header. + + The Expires header. + + + + Gets or sets the E-Tag header. + + The E-Tag header. + + + + Gets or sets the owin.ResponseBody Stream. + + The owin.ResponseBody Stream. + + + + Used to interact with authentication middleware that have been chained in the pipeline + + + + + Lists all of the description data provided by authentication middleware that have been chained + + The authentication descriptions + + + + Lists the description data of all of the authentication middleware which are true for a given predicate + + A function provided by the caller which returns true for descriptions that should be in the returned list + The authentication descriptions + + + + Call back through the middleware to ask for a specific form of authentication to be performed + on the current request + + Identifies which middleware should respond to the request + for authentication. This value is compared to the middleware's Options.AuthenticationType property. + Returns an object with the results of the authentication. The AuthenticationResult.Identity + may be null if authentication failed. Even if the Identity property is null, there may still be + AuthenticationResult.properties and AuthenticationResult.Description information returned. + + + + Called to perform any number of authentication mechanisms on the current request. + + Identifies one or more middleware which should attempt to respond + Returns the AuthenticationResult information from the middleware which responded. The + order is determined by the order the middleware are in the pipeline. Latest added is first in the list. + + + + Add information into the response environment that will cause the authentication middleware to challenge + the caller to authenticate. This also changes the status code of the response to 401. The nature of that + challenge varies greatly, and ranges from adding a response header or changing the 401 status code to + a 302 redirect. + + Additional arbitrary values which may be used by particular authentication types. + Identify which middleware should perform their alterations on the + response. If the authenticationTypes is null or empty, that means the + AuthenticationMode.Active middleware should perform their alterations on the response. + + + + Add information into the response environment that will cause the authentication middleware to challenge + the caller to authenticate. This also changes the status code of the response to 401. The nature of that + challenge varies greatly, and ranges from adding a response header or changing the 401 status code to + a 302 redirect. + + Identify which middleware should perform their alterations on the + response. If the authenticationTypes is null or empty, that means the + AuthenticationMode.Active middleware should perform their alterations on the response. + + + + Add information to the response environment that will cause the appropriate authentication middleware + to grant a claims-based identity to the recipient of the response. The exact mechanism of this may vary. + Examples include setting a cookie, to adding a fragment on the redirect url, or producing an OAuth2 + access code or token response. + + Contains additional properties the middleware are expected to persist along with + the claims. These values will be returned as the AuthenticateResult.properties collection when AuthenticateAsync + is called on subsequent requests. + Determines which claims are granted to the signed in user. The + ClaimsIdentity.AuthenticationType property is compared to the middleware's Options.AuthenticationType + value to determine which claims are granted by which middleware. The recommended use is to have a single + ClaimsIdentity which has the AuthenticationType matching a specific middleware. + + + + Add information to the response environment that will cause the appropriate authentication middleware + to grant a claims-based identity to the recipient of the response. The exact mechanism of this may vary. + Examples include setting a cookie, to adding a fragment on the redirect url, or producing an OAuth2 + access code or token response. + + Determines which claims are granted to the signed in user. The + ClaimsIdentity.AuthenticationType property is compared to the middleware's Options.AuthenticationType + value to determine which claims are granted by which middleware. The recommended use is to have a single + ClaimsIdentity which has the AuthenticationType matching a specific middleware. + + + + Add information to the response environment that will cause the appropriate authentication middleware + to revoke any claims identity associated the the caller. The exact method varies. + + Additional arbitrary values which may be used by particular authentication types. + Identifies which middleware should perform the work to sign out. + Multiple authentication types may be provided to clear out more than one cookie at a time, or to clear + cookies and redirect to an external single-sign out url. + + + + Add information to the response environment that will cause the appropriate authentication middleware + to revoke any claims identity associated the the caller. The exact method varies. + + Identifies which middleware should perform the work to sign out. + Multiple authentication types may be provided to clear out more than one cookie at a time, or to clear + cookies and redirect to an external single-sign out url. + + + + Returns the current user for the request + + + + + Exposes the security.Challenge environment value as a strong type. + + + + + Exposes the security.SignIn environment value as a strong type. + + + + + Exposes the security.SignOut environment value as a strong type. + + + + + + + + + + + + + + Exposes the security.Challenge environment value as a strong type. + + + + + Exposes the security.SignIn environment value as a strong type. + + + + + Exposes the security.SignOut environment value as a strong type. + + + + + Dictionary used to store state values about the authentication session. + + + + + Initializes a new instance of the class + + + + + Initializes a new instance of the class + + + + + + State values about the authentication session. + + + + + Gets or sets whether the authentication session is persisted across multiple requests. + + + + + Gets or sets the full path or absolute URI to be used as an http redirect response value. + + + + + Gets or sets the time at which the authentication ticket was issued. + + + + + Gets or sets the time at which the authentication ticket expires. + + + + + Gets or sets if refreshing the authentication session should be allowed. + + + + + Exposes the security.Challenge environment value as a strong type. + + + + + Initializes a new instance of the class + + + + + + + List of the authentication types that should send a challenge in the response. + + + + + Dictionary used to store state values about the authentication session. + + + + + Exposes the security.SignIn environment value as a strong type. + + + + + Initializes a new instance of the class. + + + + + + + Initializes a new instance of the class. + + + + + + + The identity associated with the user sign in. + + + + + The security principal associated with the user sign in. + + + + + Dictionary used to store state values about the authentication session. + + + + + Exposes the security.SignOut and security.SignOutProperties environment values as a strong type. + + + + + Initializes a new instance of the class + + + + + + Initializes a new instance of the class + + + + + + + List of the authentication types that should be revoked on sign out. + + + + + Dictionary used to store state values about the authentication session. + + + + + Provides an ILoggerFactory based on System.Diagnostics.TraceSource. + + + + + Initializes a new instance of the class. + + + Creates a factory named "Microsoft.Owin". + + + + + Initializes a new instance of the class. + + + + + + + Creates a new DiagnosticsLogger for the given component name. + + + + + + + ILogger extension methods for common scenarios. + + + + + Checks if the given TraceEventType is enabled. + + + + + + + + Writes a verbose log message. + + + + + + + Writes an informational log message. + + + + + + + Writes a warning log message. + + + + + + + + Writes a warning log message. + + + + + + + + Writes an error log message. + + + + + + + Writes an error log message. + + + + + + + + Writes a critical log message. + + + + + + + Writes a critical log message. + + + + + + + diff --git a/lib/owin/Microsoft.Owin.dll b/lib/owin/Microsoft.Owin.dll new file mode 100644 index 000000000..319321077 Binary files /dev/null and b/lib/owin/Microsoft.Owin.dll differ diff --git a/lib/owin/Owin.dll b/lib/owin/Owin.dll new file mode 100644 index 000000000..ba6e21eda Binary files /dev/null and b/lib/owin/Owin.dll differ diff --git a/src/Orchard.Specs/Hosting/Orchard.Web/Web.config b/src/Orchard.Specs/Hosting/Orchard.Web/Web.config index 83a1873ff..ef880caa1 100644 --- a/src/Orchard.Specs/Hosting/Orchard.Web/Web.config +++ b/src/Orchard.Specs/Hosting/Orchard.Web/Web.config @@ -18,11 +18,12 @@
- + + @@ -57,7 +58,7 @@ during development. --> - + @@ -67,6 +68,7 @@ + @@ -127,7 +129,7 @@ - + @@ -142,7 +144,7 @@ - + @@ -184,27 +186,27 @@ - + - + - + - + - + diff --git a/src/Orchard.Specs/Hosting/Simple.Web/Web.config b/src/Orchard.Specs/Hosting/Simple.Web/Web.config index c381340cf..9826c578e 100644 --- a/src/Orchard.Specs/Hosting/Simple.Web/Web.config +++ b/src/Orchard.Specs/Hosting/Simple.Web/Web.config @@ -25,6 +25,7 @@ + diff --git a/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs b/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs index f0d82221e..a855aa6b8 100644 --- a/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs +++ b/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs @@ -19,6 +19,7 @@ using Orchard.FileSystems.AppData; using Orchard.FileSystems.VirtualPath; using Orchard.Mvc.ModelBinders; using Orchard.Mvc.Routes; +using Orchard.Owin; using Orchard.Tests.Environment.TestDependencies; using Orchard.Tests.Stubs; using Orchard.Tests.Utility; @@ -62,7 +63,9 @@ namespace Orchard.Tests.Environment { .Ignore() .Ignore() .Ignore() - .Ignore(); + .Ignore() + .Ignore() + .Ignore(); }); _lifetime = _container.BeginLifetimeScope(); diff --git a/src/Orchard.Tests/Environment/DefaultOrchardShellTests.cs b/src/Orchard.Tests/Environment/DefaultOrchardShellTests.cs index e92a4b115..d180cb70a 100644 --- a/src/Orchard.Tests/Environment/DefaultOrchardShellTests.cs +++ b/src/Orchard.Tests/Environment/DefaultOrchardShellTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading.Tasks; using System.Web.Mvc; using System.Web.Routing; using NUnit.Framework; @@ -65,6 +66,8 @@ namespace Orchard.Tests.Environment { Routes = routes; } public IEnumerable Routes { get; set; } + public void Publish(IEnumerable routes, Func, Task> pipeline) { + } } public class StubModelBinderProvider : IModelBinderProvider { diff --git a/src/Orchard.Tests/Mvc/Routes/ShellRouteTests.cs b/src/Orchard.Tests/Mvc/Routes/ShellRouteTests.cs index 7fd33fba9..0f2444a2e 100644 --- a/src/Orchard.Tests/Mvc/Routes/ShellRouteTests.cs +++ b/src/Orchard.Tests/Mvc/Routes/ShellRouteTests.cs @@ -1,5 +1,8 @@ using System; +using System.Collections.Generic; using System.Linq; +using System.Runtime.Remoting.Messaging; +using System.Threading.Tasks; using System.Web; using System.Web.Mvc; using System.Web.Routing; @@ -43,6 +46,16 @@ namespace Orchard.Tests.Mvc.Routes { rootBuilder.RegisterType().As(); rootBuilder.RegisterType().As(); + rootBuilder.Register>(c => { + var context = c.Resolve(); + return new Func(routeBase => + new ShellRoute( + routeBase, + _settingsA, + context.Resolve(), + context.Resolve(), objects => { return null; })); + }); + _rootContainer = rootBuilder.Build(); _containerA = _rootContainer.BeginLifetimeScope( @@ -59,33 +72,37 @@ namespace Orchard.Tests.Mvc.Routes { builder.RegisterType().As().InstancePerMatchingLifetimeScope("shell"); }); } - + [Test] public void FactoryMethodWillCreateShellRoutes() { - var settings = new ShellSettings { Name = "Alpha" }; var builder = new ContainerBuilder(); builder.RegisterType().InstancePerDependency(); builder.RegisterAutoMocking(); - builder.Register(ctx => settings); var container = builder.Build(); - var buildShellRoute = container.Resolve>(); + var buildShellRoute = new Func(routeBase => + new ShellRoute( + routeBase, + _settingsA, + container.Resolve(), + container.Resolve(), + objects => { return null; })); var routeA = new Route("foo", new MvcRouteHandler()); var route1 = buildShellRoute(routeA); var routeB = new Route("bar", new MvcRouteHandler()) { - DataTokens = new RouteValueDictionary { { "area", "Beta" } } + DataTokens = new RouteValueDictionary { { "area", _settingsB.Name } } }; var route2 = buildShellRoute(routeB); Assert.That(route1, Is.Not.SameAs(route2)); - Assert.That(route1.ShellSettingsName, Is.EqualTo("Alpha")); + Assert.That(route1.ShellSettingsName, Is.EqualTo(_settingsA.Name)); Assert.That(route1.Area, Is.Null); - Assert.That(route2.ShellSettingsName, Is.EqualTo("Alpha")); - Assert.That(route2.Area, Is.EqualTo("Beta")); + Assert.That(route2.ShellSettingsName, Is.EqualTo(_settingsA.Name)); + Assert.That(route2.Area, Is.EqualTo(_settingsB.Name)); } @@ -196,7 +213,13 @@ namespace Orchard.Tests.Mvc.Routes { .Returns(settings); - var shellRouteFactory = container.Resolve>(); + var shellRouteFactory = new Func(routeBase => + new ShellRoute( + routeBase, + settings, + container.Resolve(), + container.Resolve(), + objects => { return null; })); var helloRoute = shellRouteFactory(new Route( "hello", diff --git a/src/Orchard.Web/Orchard.Web.csproj b/src/Orchard.Web/Orchard.Web.csproj index ce62a26bf..cf517210c 100644 --- a/src/Orchard.Web/Orchard.Web.csproj +++ b/src/Orchard.Web/Orchard.Web.csproj @@ -51,6 +51,9 @@ ..\..\lib\autofac\Autofac.dll True + + ..\..\lib\owin\Microsoft.Owin.Host.SystemWeb.dll + ..\..\lib\aspnetmvc\Microsoft.Web.Infrastructure.dll True diff --git a/src/Orchard.Web/Web.config b/src/Orchard.Web/Web.config index 2b8fb0941..b12ca1072 100644 --- a/src/Orchard.Web/Web.config +++ b/src/Orchard.Web/Web.config @@ -12,6 +12,7 @@ + @@ -53,6 +54,7 @@ + diff --git a/src/Orchard/Environment/DefaultOrchardShell.cs b/src/Orchard/Environment/DefaultOrchardShell.cs index 78199bcab..91379dce8 100644 --- a/src/Orchard/Environment/DefaultOrchardShell.cs +++ b/src/Orchard/Environment/DefaultOrchardShell.cs @@ -1,12 +1,18 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using Autofac.Features.OwnedInstances; +using Microsoft.Owin.Builder; +using Orchard.Environment.Configuration; using Orchard.Logging; using Orchard.Mvc.ModelBinders; using Orchard.Mvc.Routes; +using Orchard.Owin; using Orchard.Tasks; +using Orchard.UI; using Orchard.WebApi.Routes; +using Owin; using IModelBinderProvider = Orchard.Mvc.ModelBinders.IModelBinderProvider; namespace Orchard.Environment { @@ -18,6 +24,8 @@ namespace Orchard.Environment { private readonly IEnumerable _modelBinderProviders; private readonly IModelBinderPublisher _modelBinderPublisher; private readonly ISweepGenerator _sweepGenerator; + private readonly IEnumerable _owinMiddlewareProviders; + private readonly ShellSettings _shellSettings; public DefaultOrchardShell( Func> eventsFactory, @@ -26,7 +34,9 @@ namespace Orchard.Environment { IRoutePublisher routePublisher, IEnumerable modelBinderProviders, IModelBinderPublisher modelBinderPublisher, - ISweepGenerator sweepGenerator) { + ISweepGenerator sweepGenerator, + IEnumerable owinMiddlewareProviders, + ShellSettings shellSettings) { _eventsFactory = eventsFactory; _routeProviders = routeProviders; _httpRouteProviders = httpRouteProviders; @@ -34,6 +44,8 @@ namespace Orchard.Environment { _modelBinderProviders = modelBinderProviders; _modelBinderPublisher = modelBinderPublisher; _sweepGenerator = sweepGenerator; + _owinMiddlewareProviders = owinMiddlewareProviders; + _shellSettings = shellSettings; Logger = NullLogger.Instance; } @@ -41,11 +53,27 @@ namespace Orchard.Environment { public ILogger Logger { get; set; } public void Activate() { + IAppBuilder appBuilder = new AppBuilder(); + appBuilder.Properties["host.AppName"] = _shellSettings.Name; + + var orderedMiddlewares = _owinMiddlewareProviders + .SelectMany(p => p.GetOwinMiddlewares()) + .OrderBy(obj => obj.Priority, new FlatPositionComparer()); + + foreach (var middleware in orderedMiddlewares) { + middleware.Configure(appBuilder); + } + + // register the Orchard middleware after all others + appBuilder.UseOrchard(); + + Func, Task> pipeline = appBuilder.Build(); + var allRoutes = new List(); allRoutes.AddRange(_routeProviders.SelectMany(provider => provider.GetRoutes())); allRoutes.AddRange(_httpRouteProviders.SelectMany(provider => provider.GetRoutes())); - _routePublisher.Publish(allRoutes); + _routePublisher.Publish(allRoutes, pipeline); _modelBinderPublisher.Publish(_modelBinderProviders.SelectMany(provider => provider.GetModelBinders())); using (var events = _eventsFactory()) { diff --git a/src/Orchard/Mvc/Routes/IRoutePublisher.cs b/src/Orchard/Mvc/Routes/IRoutePublisher.cs index 47675aa7a..6a8cee448 100644 --- a/src/Orchard/Mvc/Routes/IRoutePublisher.cs +++ b/src/Orchard/Mvc/Routes/IRoutePublisher.cs @@ -1,7 +1,9 @@ +using System; using System.Collections.Generic; +using System.Threading.Tasks; namespace Orchard.Mvc.Routes { public interface IRoutePublisher : IDependency { - void Publish(IEnumerable routes); + void Publish(IEnumerable routes, Func, Task> pipeline = null); } } \ No newline at end of file diff --git a/src/Orchard/Mvc/Routes/RoutePublisher.cs b/src/Orchard/Mvc/Routes/RoutePublisher.cs index f11e18d9b..0c5f7ab12 100644 --- a/src/Orchard/Mvc/Routes/RoutePublisher.cs +++ b/src/Orchard/Mvc/Routes/RoutePublisher.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using System.Web.Http; using System.Web.Mvc; using System.Web.Routing; @@ -32,7 +33,7 @@ namespace Orchard.Mvc.Routes { _extensionManager = extensionManager; } - public void Publish(IEnumerable routes) { + public void Publish(IEnumerable routes, Func, Task> env) { var routesArray = routes .OrderByDescending(r => r.Priority) .ToArray(); @@ -52,7 +53,7 @@ namespace Orchard.Mvc.Routes { preloading.Add(routeDescriptor.Name, routeDescriptor.Route); } - + using (_routeCollection.GetWriteLock()) { // existing routes are removed while the collection is briefly inaccessable @@ -66,17 +67,17 @@ namespace Orchard.Mvc.Routes { var defaultSessionState = SessionStateBehavior.Default; ExtensionDescriptor extensionDescriptor = null; - if(routeDescriptor.Route is Route) { + if (routeDescriptor.Route is Route) { object extensionId; var route = routeDescriptor.Route as Route; - if(route.DataTokens != null && route.DataTokens.TryGetValue("area", out extensionId) || + if (route.DataTokens != null && route.DataTokens.TryGetValue("area", out extensionId) || route.Defaults != null && route.Defaults.TryGetValue("area", out extensionId)) { - extensionDescriptor = _extensionManager.GetExtension(extensionId.ToString()); + extensionDescriptor = _extensionManager.GetExtension(extensionId.ToString()); } } - else if(routeDescriptor.Route is IRouteWithArea) { + else if (routeDescriptor.Route is IRouteWithArea) { var route = routeDescriptor.Route as IRouteWithArea; - extensionDescriptor = _extensionManager.GetExtension(route.Area); + extensionDescriptor = _extensionManager.GetExtension(route.Area); } if (extensionDescriptor != null) { @@ -87,9 +88,9 @@ namespace Orchard.Mvc.Routes { } // Route-level setting overrides module-level setting (from manifest). - var sessionStateBehavior = routeDescriptor.SessionState == SessionStateBehavior.Default ? defaultSessionState : routeDescriptor.SessionState ; + var sessionStateBehavior = routeDescriptor.SessionState == SessionStateBehavior.Default ? defaultSessionState : routeDescriptor.SessionState; - var shellRoute = new ShellRoute(routeDescriptor.Route, _shellSettings, _workContextAccessor, _runningShellTable) { + var shellRoute = new ShellRoute(routeDescriptor.Route, _shellSettings, _workContextAccessor, _runningShellTable, env) { IsHttpRoute = routeDescriptor is HttpRouteDescriptor, SessionState = sessionStateBehavior }; diff --git a/src/Orchard/Mvc/Routes/ShellRoute.cs b/src/Orchard/Mvc/Routes/ShellRoute.cs index bb84db902..6fdafcc27 100644 --- a/src/Orchard/Mvc/Routes/ShellRoute.cs +++ b/src/Orchard/Mvc/Routes/ShellRoute.cs @@ -1,5 +1,6 @@ using System; -using System.Diagnostics; +using System.Collections.Generic; +using System.Threading.Tasks; using System.Web; using System.Web.Mvc; using System.Web.Routing; @@ -15,12 +16,14 @@ namespace Orchard.Mvc.Routes { private readonly ShellSettings _shellSettings; private readonly IWorkContextAccessor _workContextAccessor; private readonly IRunningShellTable _runningShellTable; + private readonly Func, Task> _pipeline; private readonly UrlPrefix _urlPrefix; - public ShellRoute(RouteBase route, ShellSettings shellSettings, IWorkContextAccessor workContextAccessor, IRunningShellTable runningShellTable) { + public ShellRoute(RouteBase route, ShellSettings shellSettings, IWorkContextAccessor workContextAccessor, IRunningShellTable runningShellTable, Func, Task> pipeline) { _route = route; _shellSettings = shellSettings; _runningShellTable = runningShellTable; + _pipeline = pipeline; _workContextAccessor = workContextAccessor; if (!string.IsNullOrEmpty(_shellSettings.RequestUrlPrefix)) _urlPrefix = new UrlPrefix(_shellSettings.RequestUrlPrefix); @@ -56,13 +59,13 @@ namespace Orchard.Mvc.Routes { } // otherwise wrap handler and return it - routeData.RouteHandler = new RouteHandler(_workContextAccessor, routeData.RouteHandler, SessionState); + routeData.RouteHandler = new RouteHandler(_workContextAccessor, routeData.RouteHandler, SessionState, _pipeline); routeData.DataTokens["IWorkContextAccessor"] = _workContextAccessor; if (IsHttpRoute) { routeData.Values["IWorkContextAccessor"] = _workContextAccessor; // for WebApi } - + return routeData; } @@ -93,26 +96,30 @@ namespace Orchard.Mvc.Routes { private readonly IWorkContextAccessor _workContextAccessor; private readonly IRouteHandler _routeHandler; private readonly SessionStateBehavior _sessionStateBehavior; + private readonly Func, Task> _pipeline; - public RouteHandler(IWorkContextAccessor workContextAccessor, IRouteHandler routeHandler, SessionStateBehavior sessionStateBehavior) { + public RouteHandler(IWorkContextAccessor workContextAccessor, IRouteHandler routeHandler, SessionStateBehavior sessionStateBehavior, Func, Task> pipeline) { _workContextAccessor = workContextAccessor; _routeHandler = routeHandler; _sessionStateBehavior = sessionStateBehavior; + _pipeline = pipeline; } public IHttpHandler GetHttpHandler(RequestContext requestContext) { var httpHandler = _routeHandler.GetHttpHandler(requestContext); + requestContext.HttpContext.SetSessionStateBehavior(_sessionStateBehavior); - + if (httpHandler is IHttpAsyncHandler) { - return new HttpAsyncHandler(_workContextAccessor, (IHttpAsyncHandler)httpHandler); + return new HttpAsyncHandler(_workContextAccessor, httpHandler, _pipeline); } + return new HttpHandler(_workContextAccessor, httpHandler); } } class HttpHandler : IHttpHandler, IRequiresSessionState, IHasRequestContext { - protected readonly IWorkContextAccessor _workContextAccessor; + private readonly IWorkContextAccessor _workContextAccessor; private readonly IHttpHandler _httpHandler; public HttpHandler(IWorkContextAccessor workContextAccessor, IHttpHandler httpHandler) { @@ -138,33 +145,40 @@ namespace Orchard.Mvc.Routes { } } - class HttpAsyncHandler : HttpHandler, IHttpAsyncHandler { + class HttpAsyncHandler : HttpTaskAsyncHandler, IRequiresSessionState { + private readonly IWorkContextAccessor _workContextAccessor; private readonly IHttpAsyncHandler _httpAsyncHandler; - private IDisposable _scope; + private readonly Func, Task> _pipeline; - public HttpAsyncHandler(IWorkContextAccessor containerProvider, IHttpAsyncHandler httpAsyncHandler) - : base(containerProvider, httpAsyncHandler) { - _httpAsyncHandler = httpAsyncHandler; + public HttpAsyncHandler(IWorkContextAccessor workContextAccessor, IHttpHandler httpHandler, Func, Task> env) { + _workContextAccessor = workContextAccessor; + _httpAsyncHandler = httpHandler as IHttpAsyncHandler; + _pipeline = env; } - public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData) { - _scope = _workContextAccessor.CreateWorkContextScope(new HttpContextWrapper(context)); - try { - return _httpAsyncHandler.BeginProcessRequest(context, cb, extraData); - } - catch { - _scope.Dispose(); - throw; - } + public override void ProcessRequest(HttpContext context) { + throw new NotImplementedException(); } - [DebuggerStepThrough] - public void EndProcessRequest(IAsyncResult result) { - try { - _httpAsyncHandler.EndProcessRequest(result); - } - finally { - _scope.Dispose(); + public override async Task ProcessRequestAsync(HttpContext context) { + using (_workContextAccessor.CreateWorkContextScope(new HttpContextWrapper(context))) { + + var environment = context.Items["owin.Environment"] as IDictionary; + + if (environment == null) { + // It seems Owin is disabled by the owin:AutomaticAppStartup=false appSettings configuration. + environment = new Dictionary(); + } + + environment["orchard.Handler"] = new Func(async () => { + await Task.Factory.FromAsync( + _httpAsyncHandler.BeginProcessRequest, + _httpAsyncHandler.EndProcessRequest, + context, + null); + }); + + await _pipeline.Invoke(environment); } } } diff --git a/src/Orchard/Orchard.Framework.csproj b/src/Orchard/Orchard.Framework.csproj index eb99bafc8..d026b52c0 100644 --- a/src/Orchard/Orchard.Framework.csproj +++ b/src/Orchard/Orchard.Framework.csproj @@ -81,6 +81,9 @@ ..\..\lib\log4net\log4net.dll + + ..\..\lib\owin\Microsoft.Owin.dll + False ..\..\lib\newtonsoft.json\Newtonsoft.Json.dll @@ -94,6 +97,9 @@ False ..\..\lib\nhibernate.linq\NHibernate.Linq.dll + + ..\..\lib\owin\Owin.dll + 3.5 @@ -312,6 +318,10 @@ + + + + diff --git a/src/Orchard/Owin/IOwinMiddlewareProvider.cs b/src/Orchard/Owin/IOwinMiddlewareProvider.cs new file mode 100644 index 000000000..e7a274e91 --- /dev/null +++ b/src/Orchard/Owin/IOwinMiddlewareProvider.cs @@ -0,0 +1,7 @@ +using System.Collections.Generic; + +namespace Orchard.Owin { + public interface IOwinMiddlewareProvider : IDependency { + IEnumerable GetOwinMiddlewares(); + } +} \ No newline at end of file diff --git a/src/Orchard/Owin/OrchardMiddleware.cs b/src/Orchard/Owin/OrchardMiddleware.cs new file mode 100644 index 000000000..69d6bfe38 --- /dev/null +++ b/src/Orchard/Owin/OrchardMiddleware.cs @@ -0,0 +1,20 @@ +using System; +using System.Threading.Tasks; +using Owin; + +namespace Orchard.Owin { + public static class OrchardMiddleware { + public static IAppBuilder UseOrchard(this IAppBuilder app) { + app.Use(async (context, next) => { + var handler = context.Environment["orchard.Handler"] as Func; + + if (handler == null) { + throw new ArgumentException("orchard.Handler can't be null"); + } + await handler(); + }); + + return app; + } + } +} diff --git a/src/Orchard/Owin/OwinMiddleware.cs b/src/Orchard/Owin/OwinMiddleware.cs new file mode 100644 index 000000000..9a9784d9b --- /dev/null +++ b/src/Orchard/Owin/OwinMiddleware.cs @@ -0,0 +1,9 @@ +using System; +using Owin; + +namespace Orchard.Owin { + public class OwinMiddleware { + public Action Configure { get; set; } + public string Priority { get; set; } + } +} diff --git a/src/Orchard/Owin/Startup.cs b/src/Orchard/Owin/Startup.cs new file mode 100644 index 000000000..456bed044 --- /dev/null +++ b/src/Orchard/Owin/Startup.cs @@ -0,0 +1,12 @@ +using Owin; + +namespace Orchard.Owin { + public class Startup { + public void Configuration(IAppBuilder app) { + app.Use((context, next) => { + context.Response.Headers.Append("X-Generator", "Orchard"); + return next(); + }); + } + } +} \ No newline at end of file