首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

PnP-WOPI-master.zip

后端 430.34KB 23 需要积分: 1
立即下载

资源介绍:

office文件读写程序
--- page_type: sample products: - office-365 languages: - csharp extensions: contentType: samples createdDate: 1/14/2016 6:35:35 AM --- # PnP-WOPI This repository contains an application that integrates with Office Online for viewing/editing Office documents. This type of integration classifies this application as a WOPI host. WOPI (Web Application Open Platform Interface) is a protocol for integrating with Office Online and is documented in detail at [https://wopi.readthedocs.org](https://wopi.readthedocs.org "https://wopi.readthedocs.org"). This sample illustrates many important patterns and practices for implementing a WOPI host, a number of which are outlined in this readme. This WOPI host implementation is deployed to [https://officewopi.azurewebsites.net](https://officewopi.azurewebsites.net "https://officewopi.azurewebsites.net") and can be used/tested by anyone with an organization/student account registered with Microsoft (read: Office 365 logins). It is provided for testing/experimenting purposes and offered with no service level agreement. > NOTE: You cannot simply clone and run this sample locally. Integrating with Office Online requires that your host domain is white-listed by Microsoft. The first step to white-listing a domain is to join the Cloud Storage Provider Program detail [HERE](http://dev.office.com/programs/officecloudstorage "HERE"). Additionally, a WOPI host must expose endpoints to the internet that Office Online can communicate with (read: localhost probably won't work). ## Solution Overview ## This WOPI host sample is written in ASP.NET/C# with MVC for the user interface and Web API for the WOPI endpoints. Although it uses Azure AD for user identity, Azure AD has NOTHING to do with the WOPI integration. A WOPI host can use virtually any identity provider (or function anonymously). The sample stores files in Azure Blob Storage and file metadata in Azure DocumentDB (a NoSQL platform service similar to MongoDB). There a number of configuration values that should be updated in the web.config to support the identity and storage providers: A WOPI host is composed of two primary components...a frame to host the Office Online renderings and endpoints that Office Online can call into to perform specific operations (ex: GetFile, PutFile, etc). Both of these components and their unique considerations are detailed below. ## WOPI Host Page ## The WOPI host page for this sample is found in the **Home/Detail** view with logic in the **Detail** method of the **HomeController.cs**. This page can only be invoked with a WOPI action and a file id. The WOPI action includes details on how to reach Office Online for the desired action (ex: view, edit, etc). The file id is used to look up file details which placed in a form in the Detail view that is posted to the WOPI action URL. When invoked, the controller will also generate a user and file specific access token that is part of the POST to the WOPI action URL.
Essentially, the WOPI Host Page hosts and posts data to a big IFRAME that renders Office Online. ## WOPI Endpoints ## The WOPI endpoints should not use the default auth that is configured in Startup.Auth.cs. Remember, Office Online is what calls into these endpoints and it has no dependency on Azure AD. Office Online will pass an access token in the header of all WOPI requests (using the Authorization header). This is the exact same access token that the WOPI Host Page generated a posted to the WOPI action URL. To accomplish this from the same web application, the **WebApiConfig.cs** needs to ignore the default authentication: // Ignore AAD Auth for WebAPI...will be handled by WopiTokenValidationFilter class config.SuppressDefaultHostAuthentication(); The application also needs a **AuthorizeAttribute** to validate the access token on requests. This sample implements this in the **WopiTokenValidationFilter** class. The WebAPI routes are all configured with this filter as seen below. The **WopiSecurity** class contains methods to generate and validate our custom access tokens. [WopiTokenValidationFilter] [HttpGet] [Route("wopi/files/{id}")] public async Task Get(Guid id) { //Handles CheckFileInfo return await HttpContext.Current.ProcessWopiRequest(); } One of the challenges of implementing the WOPI endpoints with WebAPI is that most of the WOPI operations use the same few routes. Operations are instead determined by the header details included on requests. As such, the **filesController** has four generic endpoints that simply call a **ProcessWopiRequest** extension on the HttpContext: [WopiTokenValidationFilter] public class filesController : ApiController { [WopiTokenValidationFilter] [HttpGet] [Route("wopi/files/{id}")] public async Task Get(Guid id) { //Handles CheckFileInfo return await HttpContext.Current.ProcessWopiRequest(); } [WopiTokenValidationFilter] [HttpGet] [Route("wopi/files/{id}/contents")] public async Task Contents(Guid id) { //Handles GetFile return await HttpContext.Current.ProcessWopiRequest(); } [WopiTokenValidationFilter] [HttpPost] [Route("wopi/files/{id}")] public async Task Post(Guid id) { //Handles Lock, GetLock, RefreshLock, Unlock, UnlockAndRelock, PutRelativeFile, RenameFile, PutUserInfo return await HttpContext.Current.ProcessWopiRequest(); } [WopiTokenValidationFilter] [HttpPost] [Route("wopi/files/{id}/contents")] public async Task PostContents(Guid id) { //Handles PutFile return await HttpContext.Current.ProcessWopiRequest(); } } Most of the WOPI logic exists in the **WOPIExtensions.cs** and **WOPIUtils.cs** files. The **WOPIExtensions.cs** file contains extension methods for each WOPI operation and the **WOPIUtils.cs** contains utility methods for doing things such as WOPI discovery (which lists all the actions and proof keys for the WOPI integration), validating WOPI proof (ie - proving that the WOPI request actually came from Offi

资源文件列表:

PnP-WOPI-master.zip 大约有85个文件
  1. PnP-WOPI-master/
  2. PnP-WOPI-master/.gitignore 2.84KB
  3. PnP-WOPI-master/LICENSE 1.06KB
  4. PnP-WOPI-master/README.md 8.24KB
  5. PnP-WOPI-master/com.microsoft.dx.officewopi.sln 1KB
  6. PnP-WOPI-master/com.microsoft.dx.officewopi/
  7. PnP-WOPI-master/com.microsoft.dx.officewopi/App_Start/
  8. PnP-WOPI-master/com.microsoft.dx.officewopi/App_Start/BundleConfig.cs 1.23KB
  9. PnP-WOPI-master/com.microsoft.dx.officewopi/App_Start/FilterConfig.cs 282B
  10. PnP-WOPI-master/com.microsoft.dx.officewopi/App_Start/RouteConfig.cs 620B
  11. PnP-WOPI-master/com.microsoft.dx.officewopi/App_Start/Startup.Auth.cs 4.25KB
  12. PnP-WOPI-master/com.microsoft.dx.officewopi/App_Start/WebApiConfig.cs 799B
  13. PnP-WOPI-master/com.microsoft.dx.officewopi/Content/
  14. PnP-WOPI-master/com.microsoft.dx.officewopi/Content/Site.css 1.45KB
  15. PnP-WOPI-master/com.microsoft.dx.officewopi/Content/bootstrap.css 117.68KB
  16. PnP-WOPI-master/com.microsoft.dx.officewopi/Content/bootstrap.min.css 95.65KB
  17. PnP-WOPI-master/com.microsoft.dx.officewopi/Controllers/
  18. PnP-WOPI-master/com.microsoft.dx.officewopi/Controllers/HomeController.cs 6.35KB
  19. PnP-WOPI-master/com.microsoft.dx.officewopi/Controllers/filesController.cs 1.57KB
  20. PnP-WOPI-master/com.microsoft.dx.officewopi/Controllers/foldersController.cs 1.37KB
  21. PnP-WOPI-master/com.microsoft.dx.officewopi/Global.asax 118B
  22. PnP-WOPI-master/com.microsoft.dx.officewopi/Global.asax.cs 677B
  23. PnP-WOPI-master/com.microsoft.dx.officewopi/Models/
  24. PnP-WOPI-master/com.microsoft.dx.officewopi/Models/DetailedFileModel.cs 4.15KB
  25. PnP-WOPI-master/com.microsoft.dx.officewopi/Models/FileModel.cs 1.17KB
  26. PnP-WOPI-master/com.microsoft.dx.officewopi/Models/Wopi/
  27. PnP-WOPI-master/com.microsoft.dx.officewopi/Models/Wopi/WopiAction.cs 705B
  28. PnP-WOPI-master/com.microsoft.dx.officewopi/Models/Wopi/WopiProof.cs 590B
  29. PnP-WOPI-master/com.microsoft.dx.officewopi/Models/Wopi/WopiRequest.cs 482B
  30. PnP-WOPI-master/com.microsoft.dx.officewopi/Models/Wopi/WopiRequestType.cs 1.05KB
  31. PnP-WOPI-master/com.microsoft.dx.officewopi/Project_Readme.html 5.01KB
  32. PnP-WOPI-master/com.microsoft.dx.officewopi/Properties/
  33. PnP-WOPI-master/com.microsoft.dx.officewopi/Properties/AssemblyInfo.cs 1.35KB
  34. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/
  35. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/_references.js 684B
  36. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/bootstrap.js 57.86KB
  37. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/bootstrap.min.js 27.85KB
  38. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/filedrop-min.js 17.63KB
  39. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/jquery-1.10.2.intellisense.js 155.99KB
  40. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/jquery-1.10.2.js 267.57KB
  41. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/jquery-1.10.2.min.js 91.93KB
  42. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/jquery-1.10.2.min.map 136.75KB
  43. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/jquery.validate-vsdoc.js 42.36KB
  44. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/jquery.validate.js 38.81KB
  45. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/jquery.validate.min.js 21.35KB
  46. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/jquery.validate.unobtrusive.js 18.95KB
  47. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/jquery.validate.unobtrusive.min.js 6.13KB
  48. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/modernizr-2.6.2.js 50.25KB
  49. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/respond.js 10.08KB
  50. PnP-WOPI-master/com.microsoft.dx.officewopi/Scripts/respond.min.js 4.75KB
  51. PnP-WOPI-master/com.microsoft.dx.officewopi/Security/
  52. PnP-WOPI-master/com.microsoft.dx.officewopi/Security/WopiSecurity.cs 4.95KB
  53. PnP-WOPI-master/com.microsoft.dx.officewopi/Security/WopiTokenValidationFilter.cs 2.64KB
  54. PnP-WOPI-master/com.microsoft.dx.officewopi/Startup.cs 272B
  55. PnP-WOPI-master/com.microsoft.dx.officewopi/Utils/
  56. PnP-WOPI-master/com.microsoft.dx.officewopi/Utils/AzureStorageUtil.cs 9.23KB
  57. PnP-WOPI-master/com.microsoft.dx.officewopi/Utils/DocumentDBRepository.cs 4.68KB
  58. PnP-WOPI-master/com.microsoft.dx.officewopi/Utils/SettingsHelper.cs 891B
  59. PnP-WOPI-master/com.microsoft.dx.officewopi/Utils/WopiExtensions.cs 34.75KB
  60. PnP-WOPI-master/com.microsoft.dx.officewopi/Utils/WopiUtil.cs 15.93KB
  61. PnP-WOPI-master/com.microsoft.dx.officewopi/Views/
  62. PnP-WOPI-master/com.microsoft.dx.officewopi/Views/Home/
  63. PnP-WOPI-master/com.microsoft.dx.officewopi/Views/Home/Detail.cshtml 1.01KB
  64. PnP-WOPI-master/com.microsoft.dx.officewopi/Views/Home/Error.cshtml 98B
  65. PnP-WOPI-master/com.microsoft.dx.officewopi/Views/Home/Index.cshtml 7.16KB
  66. PnP-WOPI-master/com.microsoft.dx.officewopi/Views/Shared/
  67. PnP-WOPI-master/com.microsoft.dx.officewopi/Views/Shared/Error.cshtml 192B
  68. PnP-WOPI-master/com.microsoft.dx.officewopi/Views/Shared/_Layout.cshtml 1.01KB
  69. PnP-WOPI-master/com.microsoft.dx.officewopi/Views/Shared/_LayoutWOPI.cshtml 430B
  70. PnP-WOPI-master/com.microsoft.dx.officewopi/Views/Shared/_LoginPartial.cshtml 398B
  71. PnP-WOPI-master/com.microsoft.dx.officewopi/Views/Web.config 1.86KB
  72. PnP-WOPI-master/com.microsoft.dx.officewopi/Views/_ViewStart.cshtml 54B
  73. PnP-WOPI-master/com.microsoft.dx.officewopi/Web.Debug.config 1.21KB
  74. PnP-WOPI-master/com.microsoft.dx.officewopi/Web.Release.config 1.27KB
  75. PnP-WOPI-master/com.microsoft.dx.officewopi/Web.config 4.73KB
  76. PnP-WOPI-master/com.microsoft.dx.officewopi/Web.config.backup.1 2.76KB
  77. PnP-WOPI-master/com.microsoft.dx.officewopi/com.microsoft.dx.officewopi.csproj 19.46KB
  78. PnP-WOPI-master/com.microsoft.dx.officewopi/favicon.ico 31.29KB
  79. PnP-WOPI-master/com.microsoft.dx.officewopi/fonts/
  80. PnP-WOPI-master/com.microsoft.dx.officewopi/fonts/glyphicons-halflings-regular.eot 13.75KB
  81. PnP-WOPI-master/com.microsoft.dx.officewopi/fonts/glyphicons-halflings-regular.svg 61.68KB
  82. PnP-WOPI-master/com.microsoft.dx.officewopi/fonts/glyphicons-halflings-regular.ttf 28.82KB
  83. PnP-WOPI-master/com.microsoft.dx.officewopi/fonts/glyphicons-halflings-regular.woff 16.06KB
  84. PnP-WOPI-master/com.microsoft.dx.officewopi/packages.config 3.26KB
  85. PnP-WOPI-master/com.microsoft.dx.officewopi/wopitest.wopitest 14B
0评论
提交 加载更多评论
其他资源 HP1020打印机华硕梅林驱动
HP1020打印机华硕梅林驱动
该资源仅供个人练习使用
该资源仅供个人练习使用
印象笔记111111111
印象笔记111111111
j2me 开发
eclipse 开发 j2me
细胞计数(课程设计项目).zip
c
基于MATLAB的直线检测(课程项目).zip
python
基于MATLAB的细胞计数(课程项目).zip
python
MAAB建模规范,最新5.0版本
mathworks最新建模规范,5.0版本,高清pdf