Skip to content

Latest commit

 

History

History
157 lines (111 loc) · 10.9 KB

README.md

File metadata and controls

157 lines (111 loc) · 10.9 KB

Logo WopiHost

Build & Test codecov Maintainability CodeFactor FOSSA Status .NET Core

Package Version Downloads
WopiHost.Abstractions NuGet NuGet
WopiHost.Core NuGet NuGet
WopiHost.Discovery NuGet NuGet
WopiHost.FileSystemProvider NuGet NuGet
WopiHost.Url NuGet NuGet

Introduction

This project is a sample implementation of a WOPI host. Basically, it allows developers to integrate custom datasources with Office Online Server (formerly Office Web Apps) or any other WOPI client by implementing a bunch of interfaces.

Features / improvements compared to existing samples on the web

  • clean WebAPI built with ASP.NET Core MVC (no references to System.Web)
  • uses new ASP.NET Core features (configuration, etc.)
  • can be self-hosted or run under IIS
  • file manipulation is extracted to own layer of abstraction (there is no dependency on System.IO)
    • example implementation included (provider for Windows file system)
    • file identifiers can be anything (doesn't have to correspond with the file's name in the file system)
  • custom token authentication middleware
  • DI used everywhere
  • URL generator
    • based on a WOPI discovery module
  • all references are NuGets

Usage

Prerequisites

Building the app

The WopiHost app targets both net8.0 and net9.0.

If you need a version that's targeting an older version of .NET, check out the releases:

If you get errors saying that Microsoft.CobaltCore.*.nupkg can't be found, then just remove the reference or see the chapter Cobalt below.

Samples

See Samples for all samples.

Compatible WOPI Clients

Running the application only makes sense with a WOPI client as its counterpart. WopiHost is compatible with the following clients:

Office Online Server 2016

deployment guidelines

Note that WopiHost will always be compatible only with the latest version of OOS because Microsoft also supports only the latest version.

The deployment of OOS/OWA requires the server to be part of a domain. If your server is not part of any domain (e.g. you're running it in a VM sandbox) it can be overcome by promoting your machine to a Domain Controller. To test your OWA server follow the instructions here. To remove the OWA instance use Remove-OfficeWebAppsMachine.

Microsoft 365 for the Web

You can use WopiHost to integrate with Microsoft 365 for the web which will require:

Cobalt

In the past (in Office Web Apps 2013), some HTTP actions required support of MS-FSSHTTP protocol (also known as "cobalt"). This is no longer true with Office Online Server 2016. However, if the WOPI client discovers (via SupportsCobalt property) that the WOPI host supports cobalt, it'll take advantage of it as it's more efficient.

If you need or want your project to use Cobalt, you'll need to create a NuGet package called Microsoft.CobaltCore.nupkg containing Microsoft.CobaltCore.dll. This DLL is part of Office Web Apps 2013 / Office Online Server 2016 and its license doesn't allow public distribution and therefore it's not part of this repository. Please always make sure your OWA/OOS server and user connecting to it have valid licenses before you start using it.

Using in your web project

TODO

Extending

IWopiStorageProvider

The IWopiStorageProvider interface is the main interface that needs to be implemented to provide access to the files. It's up to you how you implement it. One sample implementation is in the WopiHost.FileSystemProvider project.

IWopiSecurityHandler

The IWopiSecurityHandler interface is used to authenticate and authorize resource requests. One sample implementation is in the WopiHost.FileSystemProvider project.

IWopiLockProvider

The IWopiLockProvider interface is used to handle file locks. One sample implementation is in the WopiHost.MemoryLockProvider project.

CheckFileInfo

The CheckFileInfo includes not only details about the file but also some additional properties that can be used by the WOPI client. You can either completely customize the response (by adding your own / missing properties), or update any properties before returning them by registering for the OnCheckFileInfo event.

CheckContainerInfo

The CheckContainerInfo includes also some security related properties (that are checked by IWopiSecurityHandler), but you can still customize the response using the OnCheckContainerInfo event.

TODO additional details

Known issues / TODOs

There is plenty of space for improvements in the overall architecture, implementation of the [MS-*] protocols or just finishing the TODOs in the code. Lot of refactoring still needs to be done and also the code style has to be unified. So please feel free to help me out with it :)

Contributing

https://learn.microsoft.com/dotnet/standard/design-guidelines/

License

Useful resources

Building WOPI Host

MS-FSSHTTP (Cobalt)

Building WOPI Client

FOSSA Status