2015-01-16 10 views
6

के साथ प्रमाणित करने में विफल होने वाली नई-वेब सेवाप्रॉक्सी मैं एक अजीब मुद्दे से निपट रहा हूं। हमें अपने शेयरपॉइंट फार्म पर सूची सेवा को हिट करने की आवश्यकता है। वेब प्रमाणीकरण एक ओरेकल एसएसओ के माध्यम से संघीय है, लेकिन हमारे पास स्वचालन के लिए कॉन्फ़िगर किए गए खाते हैं जो वेब अनुरोध कर सकते हैं। एएएम का उपयोग करके, हमारे पास सर्वर साइड ऑटोमेशन के लिए एक "आंतरिक" यूआरएल कॉन्फ़िगर किया गया है जो सीधे एडी को छोड़ देता है, और बाकी सब कुछ एसएसओ को धक्का दिया जाता है।एनटीएलएम

यहां कोड (sanitized) है जिसे मैं सूची संग्रह प्राप्त करने का प्रयास करने के लिए उपयोग कर रहा हूं।

$username = "DOMAIN\username" 
$password = "somepassword" 
$site = "https://sp.biz.com/sites/SiteCollection" 

$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, (ConvertTo-SecureString $password -AsPlainText -Force) 

$proxy = New-WebServiceProxy -Uri "$site/_vti_bin/Lists.asmx" -Credentials $credentials 

$proxy.GetListCollection() 

मैं एक 403 से मारा हूँ जब मुझे लगता है कि कोड का उपयोग करें।

अपवाद "0" तर्क (रों) के साथ "GetListCollection" बुला: "सर्वर अनुरोध संसाधित नहीं कर पाया ---> पहुंच अस्वीकृत कर दी (HRESULT से अपवाद: 0x80070005 (E_ACCESSDENIED))।।"

यदि मैं आंतरिक यूआरएल (एएएम के माध्यम से सेट) का उपयोग करने के लिए $ साइट बदलता हूं और इसे फ्रंट सिरों में से एक पर चलाता हूं, तो मुझे सूची संग्रह सफलतापूर्वक प्राप्त होता है। अब, पहले मैंने सोचा था कि खाते और अनुमतियों के साथ कोई समस्या थी, लेकिन फिडलर कैप्चर चलाने के बाद मुझे लगता है कि यह बिल्कुल प्रमाणीकरण नहीं कर रहा है।

जब मैं निम्न कर्ल कमांड चलाता हूं, तो यह प्रमाणित करता है और सूची संग्रह देता है। Soap.xml केवल WDSL से कॉपी की गई मूल GetListCollection पैकेट है।

curl -v -u 'username':'pass' --ntlm -X POST -H "Content-Type: text/xml" --data-binary @soap.xml https://sp.biz.com/sites/SiteCollection/_vti_bin/Lists.asmx 

यहाँ cURL से स्वच्छ वर्बोज़ उत्पादन है।

* STATE: INIT => CONNECT handle 0x600056190; line 1029 (connection #-5000) 
* Hostname was NOT found in DNS cache 
* Trying <IPv6>... 
* STATE: CONNECT => WAITCONNECT handle 0x600056190; line 1082 (connection #0) 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
    0  0 0  0 0  0  0  0 --:--:-- --:--:-- --:--:--  0* Connected to sp.biz.com (<IPv6>) port 443 (#0) 
* successfully set certificate verify locations: 
* CAfile: /usr/ssl/certs/ca-bundle.crt 
    CApath: none 
* SSLv3, TLS handshake, Client hello (1): 
} [data not shown] 
* STATE: WAITCONNECT => PROTOCONNECT handle 0x600056190; line 1222 (connection #0) 
* SSLv3, TLS handshake, Server hello (2): 
{ [data not shown] 
* SSLv3, TLS handshake, CERT (11): 
{ [data not shown] 
* SSLv3, TLS handshake, Server finished (14): 
{ [data not shown] 
* SSLv3, TLS handshake, Client key exchange (16): 
} [data not shown] 
* SSLv3, TLS change cipher, Client hello (1): 
} [data not shown] 
* SSLv3, TLS handshake, Finished (20): 
} [data not shown] 
* SSLv3, TLS change cipher, Client hello (1): 
{ [data not shown] 
* SSLv3, TLS handshake, Finished (20): 
{ [data not shown] 
* SSL connection using TLSv1.2/DES-CBC3-SHA 
*  SSL certificate verify ok. 
* STATE: PROTOCONNECT => DO handle 0x600056190; line 1241 (connection #0) 
* Server auth using NTLM with user 'DOMAIN\username' 
> POST /sites/SiteCollection/_vti_bin/Lists.asmx HTTP/1.1 
> Authorization: NTLM <snip> 
> User-Agent: curl/7.39.0 
> Host: sp.biz.com 
> Accept: */* 
> Content-Type: text/xml 
> Content-Length: 0 
> 
* STATE: DO => DO_DONE handle 0x600056190; line 1314 (connection #0) 
* STATE: DO_DONE => WAITPERFORM handle 0x600056190; line 1441 (connection #0) 
* STATE: WAITPERFORM => PERFORM handle 0x600056190; line 1454 (connection #0) 
* HTTP 1.1 or later with persistent connection, pipelining supported 
< HTTP/1.1 401 Unauthorized 
* Server Microsoft-IIS/7.5 is not blacklisted 
< Server: Microsoft-IIS/7.5 
< SPRequestGuid: <snip> 
< WWW-Authenticate: NTLM <snip> 
< X-Powered-By: ASP.NET 
< MicrosoftSharePointTeamServices: 14.0.0.7006 
< X-MS-InvokeApp: 1; RequireReadOnly 
< Date: Fri, 16 Jan 2015 01:02:56 GMT 
< Content-Length: 0 
< Set-Cookie: BIGipServerserver_pool=<snip>; expires=Sat, 17-Jan-2015 01:02:56 GMT; path=/ 
< 
    0  0 0  0 0  0  0  0 --:--:-- --:--:-- --:--:--  0 
* Connection #0 to host sp.biz.com left intact 
* Issue another request to this URL: 'https://sp.biz.com/sites/SiteCollection/_vti_bin/Lists.asmx' 
* STATE: PERFORM => CONNECT handle 0x600056190; line 1601 (connection #-5000) 
* Found bundle for host sp.biz.com: 0x60006aef0 
* Re-using existing connection! (#0) with host sp.biz.com 
* Connected to sp.biz.com (<IPv6>) port 443 (#0) 
* STATE: CONNECT => DO handle 0x600056190; line 1075 (connection #0) 
* Server auth using NTLM with user 'DOMAIN\username' 
> POST /sites/SiteCollection/_vti_bin/Lists.asmx HTTP/1.1 
> Authorization: NTLM <snip> 
> User-Agent: curl/7.39.0 
> Host: sp.biz.com 
> Accept: */* 
> Content-Type: text/xml 
> Content-Length: 353 
> 
} [data not shown] 
* upload completely sent off: 353 out of 353 bytes 
* STATE: DO => DO_DONE handle 0x600056190; line 1314 (connection #0) 
* STATE: DO_DONE => WAITPERFORM handle 0x600056190; line 1441 (connection #0) 
* STATE: WAITPERFORM => PERFORM handle 0x600056190; line 1454 (connection #0) 
* HTTP 1.1 or later with persistent connection, pipelining supported 
< HTTP/1.1 200 OK 
< Cache-Control: private, max-age=0 
< Content-Type: text/xml; charset=utf-8 
* Server Microsoft-IIS/7.5 is not blacklisted 
< Server: Microsoft-IIS/7.5 
< SPRequestGuid: <snip> 
< Set-Cookie: FedAuth=<snip>; expires=Fri, 16-Jan-2015 08:36:07 GMT; path=/; secure; HttpOnly 
< X-SharePointHealthScore: 0 
< X-AspNet-Version: 2.0.50727 
< Persistent-Auth: true 
< X-Powered-By: ASP.NET 
< MicrosoftSharePointTeamServices: 14.0.0.7006 
< X-MS-InvokeApp: 1; RequireReadOnly 
< Date: Fri, 16 Jan 2015 01:02:56 GMT 
< Content-Length: 104088 
< Vary: Accept-Encoding 
< 
{ [data not shown] 
* STATE: PERFORM => DONE handle 0x600056190; line 1626 (connection #0) 
100 101k 100 101k 100 353 219k 762 --:--:-- --:--:-- --:--:-- 219k 
* Connection #0 to host sp.biz.com left intact 

किसी भी सहायता की बहुत सराहना की जाती है। यदि cmdlets की कमी है तो मैं PowerShell पर C# समाधान का विरोध नहीं कर रहा हूं।


01-16-2015 12:13 PM EST अद्यतन - मैं HighlyUnavailable के सुझाव को प्रतिबिंबित करने के सवाल अद्यतन और फ़िडलर कब्जा से हेडर शामिल थे।

CONNECT sp.biz.com:443 HTTP/1.1 
Host: sp.biz.com 
Connection: Keep-Alive 
HTTP/1.1 200 Connection Established 
FiddlerGateway: Direct 
StartTime: 12:14:46.372 
Connection: close 
------------------------------------------------------------------ 
GET https://sp.biz.com/sites/SiteCollection/_vti_bin/Lists.asmx HTTP/1.1 
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.5485) 
Host: sp.biz.com 
Connection: Keep-Alive 
HTTP/1.1 200 OK 
Cache-Control: private, max-age=0 
Content-Type: text/html; charset=utf-8 
Server: Microsoft-IIS/7.5 
SPRequestGuid: <snip> 
X-SharePointHealthScore: 0 
X-AspNet-Version: 2.0.50727 
X-Powered-By: ASP.NET 
MicrosoftSharePointTeamServices: 14.0.0.7006 
X-MS-InvokeApp: 1; RequireReadOnly 
Date: Fri, 16 Jan 2015 17:14:46 GMT 
Connection: keep-alive 
Content-Length: 9066 
Set-Cookie: BIGipServerserver_pool=<snip>; expires=Sat, 17-Jan-2015 17:14:46 GMT; path=/ 
Vary: Accept-Encoding 
------------------------------------------------------------------ 
GET https://sp.biz.com/_vti_bin/Lists.asmx?disco HTTP/1.1 
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.5485) 
Host: sp.biz.com 
HTTP/1.1 200 OK 
Cache-Control: private 
Content-Type: text/xml; charset=utf-8 
Server: Microsoft-IIS/7.5 
SPRequestGuid: <snip> 
X-SharePointHealthScore: 0 
X-AspNet-Version: 2.0.50727 
X-Powered-By: ASP.NET 
MicrosoftSharePointTeamServices: 14.0.0.7006 
X-MS-InvokeApp: 1; RequireReadOnly 
Date: Fri, 16 Jan 2015 17:14:46 GMT 
Connection: close 
Content-Length: 747 
------------------------------------------------------------------ 
CONNECT sp.biz.com:443 HTTP/1.1 
Host: sp.biz.com 
Connection: Keep-Alive 
HTTP/1.1 200 Connection Established 
FiddlerGateway: Direct 
StartTime: 12:14:47.505 
Connection: close 
------------------------------------------------------------------ 
GET https://sp.biz.com/_vti_bin/Lists.asmx?wsdl HTTP/1.1 
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.5485) 
Host: sp.biz.com 
HTTP/1.1 200 OK 
Cache-Control: private 
Content-Type: text/xml; charset=utf-8 
Server: Microsoft-IIS/7.5 
SPRequestGuid: <snip> 
X-SharePointHealthScore: 0 
X-AspNet-Version: 2.0.50727 
X-Powered-By: ASP.NET 
MicrosoftSharePointTeamServices: 14.0.0.7006 
X-MS-InvokeApp: 1; RequireReadOnly 
Date: Fri, 16 Jan 2015 17:14:46 GMT 
Connection: close 
Content-Length: 72672 
Set-Cookie: BIGipServerserver_pool=<snip>; expires=Sat, 17-Jan-2015 17:14:47 GMT; path=/ 
Vary: Accept-Encoding 
------------------------------------------------------------------ 
CONNECT sp.biz.com:443 HTTP/1.1 
Host: sp.biz.com 
Connection: Keep-Alive 
HTTP/1.1 200 Connection Established 
FiddlerGateway: Direct 
StartTime: 12:14:48.727 
Connection: close 
------------------------------------------------------------------ 
POST https://sp.biz.com/_vti_bin/Lists.asmx HTTP/1.1 
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.5485) 
Content-Type: text/xml; charset=utf-8 
SOAPAction: "http://schemas.microsoft.com/sharepoint/soap/GetListCollection" 
Host: sp.biz.com 
Content-Length: 321 
Expect: 100-continue 
HTTP/1.1 500 Internal Server Error 
Cache-Control: private 
Content-Type: text/xml; charset=utf-8 
Server: Microsoft-IIS/7.5 
X-AspNet-Version: 2.0.50727 
X-Powered-By: ASP.NET 
MicrosoftSharePointTeamServices: 14.0.0.7006 
X-MS-InvokeApp: 1; RequireReadOnly 
Date: Fri, 16 Jan 2015 17:14:48 GMT 
Content-Length: 459 
Set-Cookie: BIGipServerserver_pool=686493706.47873.0000; expires=Sat, 17-Jan-2015 17:14:48 GMT; path=/ 
------------------------------------------------------------------ 

यहाँ कर रहे हैं cURL आदेश के लिए हेडर:

यहाँ PowerShell स्क्रिप्ट से स्वच्छ हेडर हैं।

CONNECT sp.biz.com:443 HTTP/1.1 
Host: sp.biz.com:443 
User-Agent: curl/7.39.0 
Connection: Keep-Alive 
Content-Type: text/xml 
HTTP/1.1 200 Connection Established 
FiddlerGateway: Direct 
StartTime: 12:21:07.928 
Connection: close 
------------------------------------------------------------------ 
POST https://sp.biz.com/sites/SiteCollection/_vti_bin/Lists.asmx HTTP/1.1 
Authorization: NTLM <snip>= 
User-Agent: curl/7.39.0 
Host: sp.biz.com 
Accept: */* 
Content-Type: text/xml 
Content-Length: 0 
HTTP/1.1 401 Unauthorized 
Server: Microsoft-IIS/7.5 
SPRequestGuid: <snip> 
WWW-Authenticate: NTLM <snip> 
X-Powered-By: ASP.NET 
MicrosoftSharePointTeamServices: 14.0.0.7006 
X-MS-InvokeApp: 1; RequireReadOnly 
Date: Fri, 16 Jan 2015 17:21:07 GMT 
Content-Length: 0 
Set-Cookie: BIGipServerserver_pool=<snip>; expires=Sat, 17-Jan-2015 17:21:07 GMT; path=/ 
Proxy-Support: Session-Based-Authentication 
------------------------------------------------------------------ 
POST https://sp.biz.com/sites/SiteCollection/_vti_bin/Lists.asmx HTTP/1.1 
Authorization: NTLM <snip> 
User-Agent: curl/7.39.0 
Host: sp.biz.com 
Accept: */* 
Content-Type: text/xml 
Content-Length: 417 
HTTP/1.1 200 OK 
Cache-Control: private, max-age=0 
Content-Type: text/xml; charset=utf-8 
Server: Microsoft-IIS/7.5 
SPRequestGuid: <snip> 
Set-Cookie: FedAuth=<snip>; expires=Sat, 17-Jan-2015 03:20:50 GMT; path=/; secure; HttpOnly 
X-SharePointHealthScore: 0 
X-AspNet-Version: 2.0.50727 
Persistent-Auth: true 
X-Powered-By: ASP.NET 
MicrosoftSharePointTeamServices: 14.0.0.7006 
X-MS-InvokeApp: 1; RequireReadOnly 
Date: Fri, 16 Jan 2015 17:21:07 GMT 
Content-Length: 66628 
Vary: Accept-Encoding 
------------------------------------------------------------------ 

उत्तर

0

मैं इस के लिए समाधान के साथ कभी नहीं आ गया, लेकिन मैं समझा सकता हूं कि क्यों। हमारे पर्यावरण में हम एसएएमएल v1.1 के साथ हमारे ओरेकल आइडेंटिटी फाउंडेशन एसएसओ के खिलाफ फॉर्म आधारित प्रमाणीकरण का उपयोग करते हैं।

जब आप प्रमाणीकृत करने का प्रयास करते हैं, तो यह आपको एसएसओ पर रीडायरेक्ट करता है, लेकिन ग्राहक एसएसओ के बजाय वास्तविक वेब फ्रंट एंड के खिलाफ एनटीएलएम का उपयोग करने का प्रयास कर रहा है। इस काम को करने के लिए, आपको डब्लूएफई (और एसएसओ नहीं) के खिलाफ एनटीएलएम का उपयोग करके वास्तव में प्रमाणित करने के लिए आपके अनुरोध में X-FORMS_BASED_AUTH_ACCEPTED: f शीर्षलेख शामिल करना होगा।

यहां समस्या है: आप PowerShell में नई-WebServiceProxy में हेडर जोड़ नहीं सकते हैं (4.0 तक - मैंने अभी तक 5 तक नहीं रोल किया है)। दूसरों के मुद्दों के लिए मैं केवल एक ही सिफारिश कर सकता हूं, अत्यधिक उपयोग के सुझावों का पालन करना, या Invoke-WebRequest का उपयोग करना और हाथ से अपने एसओएपी कॉल का निर्माण करना।

एकमात्र मुद्दा यह है कि Invoke-WebRequest आपके एन्कोडिंग को चबा सकता है, इसलिए यहां मैंने इसके आसपास काम किया है। अगर किसी के पास एन्कोडिंग समस्या के आसपास काम करने के लिए कोई सुझाव है, तो मैं सभी कान हूं।

# Set your credentials here. 
$UserName = 'BartSimpson' 
$Password = '3atmMySh0rtz!' 
$Domain = 'SF' 
$SecurePassword = ConvertTo-SecureString -String $Password -AsPlainText -Force 
$Credentials = New-Object System.Management.Automation.PSCredential (($Domain + "\" + $UserName), $SecurePassword) 

# SOAP request headers and body 
$BaseHeaders = @{"X-FORMS_BASED_AUTH_ACCEPTED" = 'f'; 
       "SOAPAction" = "`"http://schemas.microsoft.com/sharepoint/soap/GetListCollection`""; 
       "Content-Type" = "text/xml; charset=utf-8"} 
$SOAP = @" 
<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Body> 
    <GetListCollection xmlns="http://schemas.microsoft.com/sharepoint/soap/" /> 
    </soap:Body> 
</soap:Envelope> 
"@ 
# Gives us a random temp file to pipe output to 
$TmpFile = [System.IO.Path]::GetTempFileName() 
Invoke-WebRequest -Uri $URL -Headers $BaseHeaders -Credential $Credentials -Method POST -Body $SOAP -OutFile $TmpFile 
# Get the outfile with UTF8 encoding 
[xml]$Result = Get-Content -Raw -Path $TmpFile -Encoding UTF8 
# Remove the temporary file 
Remove-Item $TmpFile 

जाने के लिए एक लंबा रास्ता तय करना है, यह है जो की तरह लगता है, लेकिन यह काम करता है अगर आप PowerShell का उपयोग कर पर जोर देते हैं।

मैंने python-suds पर स्विच किया और मुझे जो करने की आवश्यकता थी वह करने में सक्षम था।

4

आप दो मौलिक रूप से अलग तकनीक यहाँ मिश्रण कर रहे हैं।

$proxy = New-WebServiceProxy -Uri "$site/_vti_bin/Lists.asmx" -UseDefaultCredential $proxy.PreAuthenticate = $TRUE $proxy.Credentials = $credentials

UseDefaultCredential पारित करने का प्रयास करेंगे अपने वर्तमान साइट के लिए Windows डोमेन उपयोगकर्ता में लॉग इन किया। हालांकि, आप प्रमाण-पत्र भी सेट कर रहे हैं। आम तौर पर, आप -Credential $credentials का प्रयोग करेंगे (http://technet.microsoft.com/en-us/library/hh849841.aspx देखें)

कर्ल आदेश आप चला रहे हैं -Credential का उपयोग कर के अधिक समान है: -u बराबर है।

इसके बजाय $proxy = New-WebServiceProxy -Uri "$site/_vti_bin/Lists.asmx" -Credential $credentials जैसे कुछ का उपयोग करने का प्रयास करें।

यदि यह काम नहीं करता है, तो कृपया अपने प्रश्न को संपादित करें ताकि हेडर्स ओरेकल एसएसओ कनेक्शन से लौटाया जा सके - यह हो सकता है कि यह केवल प्रमाण-पत्रों के लिए भी नहीं पूछ रहा हो।

+0

इनपुट के लिए धन्यवाद। मैंने कई अलग-अलग combos की कोशिश की है और उनमें से कोई भी काम नहीं कर रहा है। मेरी मूल समझ यह है कि वहां '-UseDefaultCredentials' डालकर, यह पहली कॉल के लिए अज्ञात पहुंच होगी जब तक कि यह प्रमाणीकरण चुनौती न हो जाए। मैंने मूल विषय पर कर्ल और पावरशेल दोनों के लिए अनुरोधित शीर्षलेख भी जोड़े हैं। – Taylor

+1

@ टेलरबी यह आपकी मदद कर सकता है या नहीं भी हो सकता है, लेकिन 'curl -u' पहले कॉल पर प्रमाण-पत्र भेजेगा। पावरशेल संभव नहीं होगा, और प्रमाण पत्र भेजने से पहले 401 के लिए इंतजार करेगा। मैंने [Invoke-WebRequest'] (http://stackoverflow.com/a/27951845/3905079) के संबंध में इसके बारे में लिखा है, लेकिन अंतर्निहित कोड जो कनेक्शन बनाता है शायद 'नई-वेब सेवाप्रॉक्स' के लिए समान है। – briantist

संबंधित मुद्दे