2016-11-14 8 views
0

現在、クレームベースの認証を使用するSharepoint 2016サイト内のSharepoint Foundation WebサービスAPIにアクセスする必要があるプロジェクトに取り組んでいます。クレームを提供するために使用されているセキュリティトークンサービスは、Win2k12サーバーでホストされているADFS 2.0です。ユーザは、さらなる操作のためにセキュリティトークンを認証および取得するために、自分の電子メールアドレスを提示する必要があります。クレームベースのSharepointサイトとApache CXF STSClient通信

注:これは我々がADFSエンドポイントのため

を自己署名証明書を使用しているのdevのセットアップですので、私たちは、このウェブにアクセスするためのクライアント開発スタックとしてApache CXF 2.7.12およびJDK 8を使用していますサービス。トークンを要求すると、HttpsTokenアサーションの失敗に関する例外がWARNINGレベルで記録され、何も起こりません。呼び出しが完了せず、プ​​ロセスを終了する必要があります。

これはCXFを初めて使用するためです。この問題を解決する方法についていくつかの援助と指導を依頼する。私たちは、最初の調査のために、以下のサイトを参照しているが、それらのどれもが、この特定の問題で私たちを助けているように見えません:

以下

Using Apache CXF to connect CRM Dynamics

Apache CXF Client Configuration options

SharePointサイトのWS-ポリシーとしてあります次のように我々は今STSClientを設定

<wsp:Policy wsu:Id="UserNameWSTrustBinding_IWSTrust13Async_policy"> 
<wsp:ExactlyOne> 
<wsp:All> 
<sp:TransportBinding> 
<wsp:Policy> 
<sp:TransportToken> 
<wsp:Policy> 
<sp:HttpsToken/> 
</wsp:Policy> 
</sp:TransportToken> 
<sp:AlgorithmSuite> 
<wsp:Policy> 
<sp:Basic256/> 
</wsp:Policy> 
</sp:AlgorithmSuite> 
<sp:Layout> 
<wsp:Policy> 
<sp:Strict/> 
</wsp:Policy> 
</sp:Layout> 
<sp:IncludeTimestamp/> 
</wsp:Policy> 
</sp:TransportBinding> 
<sp:SignedEncryptedSupportingTokens> 
<wsp:Policy> 
<sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> 
<wsp:Policy> 
<sp:WssUsernameToken10/> 
</wsp:Policy> 
</sp:UsernameToken> 
</wsp:Policy> 
</sp:SignedEncryptedSupportingTokens> 
<sp:EndorsingSupportingTokens> 
<wsp:Policy> 
<sp:KeyValueToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never" wsp:Optional="true"/> 
<sp:SignedParts> 
<sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing"/> 
</sp:SignedParts> 
</wsp:Policy> 
</sp:EndorsingSupportingTokens> 
<sp:Wss11> 
<wsp:Policy/> 
</sp:Wss11> 
<sp:Trust13> 
<wsp:Policy> 
<sp:MustSupportIssuedTokens/> 
<sp:RequireClientEntropy/> 
<sp:RequireServerEntropy/> 
</wsp:Policy></sp:Trust13> 
<wsaw:UsingAddressing/> 
</wsp:All> 
</wsp:ExactlyOne> 
</wsp:Policy> 

URLでご利用いただけます:

STSClient spSTSClient = new STSClient(bus); 
spSTSClient.setTrust(new Trust10(SP12Constants.INSTANCE)); 
spSTSClient.setSoap12(); 


//would we also also need to set the token type and key type? 

// spSTSClient.setTokenType("urn:oasis:names:tc:SAML:2.0:assertion"); 
//spSTSClient.setKeyType("http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer");   

spSTSClient.setWsdlLocation("https://myadfsserver.com/adfs/services/trust/mex"); 
spSTSClient.setServiceName("{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice}SecurityTokenService"); 
    spSTSClient.setEndpointName("{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice}UserNameWSTrustBinding_IWSTrust13Async"); 
      spSTSClient.setAddressingNamespace("http://www.w3.org/2005/08/addressing"); String sharePointUsername = “[email protected]"; 
String sharePointPassword = “foobar#”; 

SecurityToken secToken = spsSTSClient.requestSecurityToken("http://mysharepointsite.com/_trust"); 

requestSecurityTokenコールを以下に示します警告スロー:

WARNING: Interceptor for {http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice}SecurityTokenService#{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice}Trust13IssueAsync has thrown exception, unwinding now 
org.apache.cxf.ws.policy.PolicyException: Assertion of type {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}HttpsToken could not be asserted: Not an HTTPs connection 
    at org.apache.cxf.ws.security.policy.interceptors.HttpsTokenInterceptorProvider$HttpsTokenOutInterceptor.assertHttps(HttpsTokenInterceptorProvider.java:144) 
    at org.apache.cxf.ws.security.policy.interceptors.HttpsTokenInterceptorProvider$HttpsTokenOutInterceptor.handleMessage(HttpsTokenInterceptorProvider.java:87) 
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) 
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:570) 
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:479) 
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382) 
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335) 

答えて

0

をWSDLはTransportBindingが使用されている必要がありますが、例えば、 "https" のURLを使用していない: "http://mysharepointsite.com/_trust"

+0

をこの返答いただきありがとうございます。私はそれがコードのタイプミスであることに気付きました。しかし、この変更を行った後でさえ、問題は依然として続きます。この問題を回避する唯一の方法は、空のWSPポリシーを使用してポリシーの上書きを指定することです。しかし、私は知っている*ハック*です。トラブルシューティングのヒントは他にもあります。また、この空のポリシーXMLでは、Httpsエラーはなくなりましたが、今は{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}TransportBinding:受信タイムスタンプが一致しないというエラーが表示されます要求事項。これはどういう意味ですか? –

関連する問題