简体   繁体   English

使用 java 将文件上传到通过 ADFS SSO 身份验证的 Sharepoint Online 存储库?

[英]Using java to upload a file to a Sharepoint Online repository authenticated by ADFS SSO?

I need to upload a file to a sharepoint online repository (Office 365).我需要将文件上传到 sharepoint 在线存储库 (Office 365)。 I need to do this in java and the sharepoint online site uses ADFS for single sign-on.我需要在 java 中执行此操作,而 sharepoint 在线站点使用 ADFS 进行单点登录。

So far, all of the examples, sample-code, etc I've works for most of those requirements, but fails at one critical part (eg: java file upload with sso for a local sharepoint 2013 site, or java file upload to sharepoint online, but without the ADFS part).到目前为止,所有示例、示例代码等我都适用于大多数这些要求,但在一个关键部分失败(例如:使用 sso 上传本地sharepoint 2013 站点的 java 文件,或将 java 文件上传到 sharepoint在线,但没有 ADFS 部分)。 Authentication against ADFS seems to be one of the big sticking points.针对 ADFS 的身份验证似乎是最大的症结之一。

Does anyone have an example of this working that meets all of those requirements?有没有人有一个满足所有这些要求的工作示例?

edit-to-add: and, naturally, I've got no budget to do things like buy a commercial library that might do this quick-and-easy.编辑添加:当然,我没有预算来做一些事情,比如购买一个可以快速轻松地完成这项工作的商业图书馆。 :\\ :\\

The below are the steps you need to execute.以下是您需要执行的步骤。

  1. Since you are trying to upload from JAVA, the only option SharePoint gives is REST API - I guess you are clear on this part.由于您尝试从 JAVA 上传,SharePoint 提供的唯一选项是 REST API - 我想您对这部分很清楚。
  2. O365 identifies you(Java call) only if you send the auth token(SAML token) along with the Request body of your REST API call仅当您将身份验证令牌(SAML 令牌)与 REST API 调用的请求正文一起发送时,O365 才能识别您(Java 调用)
  3. So you have to get the SAML token first and pass it with your REST Api call因此,您必须首先获取 SAML 令牌并通过 REST Api 调用传递它

Check out these links which explain the authentication process to O365 with ADFS.查看这些链接,这些链接解释了使用 ADFS 对 O365 的身份验证过程。

Other thread in Stackoverflow Claim auth from ADFS Stackoverflow 中的其他线程从 ADFS 声明身份验证

A blog post about getting auth in a windows 8 app.一篇关于在 Windows 8 应用程序中获取身份验证的博客文章。 https://blogs.msdn.microsoft.com/omarv/2012/11/15/developing-windows-8-store-apps-for-sharepoint-online-with-sso-single-sign-on/ https://blogs.msdn.microsoft.com/omarv/2012/11/15/developing-windows-8-store-apps-for-sharepoint-online-with-sso-single-sign-on/

Only thing you have to do is, replace the C# parts with equivalent Java API calls.您唯一需要做的就是用等效的 Java API 调用替换 C# 部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM