How to authenticate with OS User while running REST API call to CCP Web service from Unix host.
To be able to authenticate CCP Web Service using OS user , we need to configure the following in IIS:
Under Default Web Site > AIMWebService,
configure the following in Authentication:
1Anonymous Authentication = Disabled
2 Windows Authentication = Enabled
It works from Windows Machine using below PowerShell script
Invoke-RestMethod -Uri "http://PVWAIP/AIMWebService/api/Accounts?AppID=ApplicationNmae&Safe=TestSafe&Object=AccountObjectName" -UseDefaultCredentials
From a Linux/Unix Machine.
Although CCP Web Service is able to authenticate OS user machine\username format. IIS WIndows Auth is not able to authenticate the Linux account which is not part for the domain. Hence IIS drops the Web Services call before it reaches CCP Web Service
Steps
The workaround is to pass a Windows Domain account through cURL and let IIS as well as CCP web services to authenticate this domain name.
1 From PVWA-->Application-->Target Application--> Add the Linux/Unix machine IP address to "Allowed Machines"
2 Add The domain user to OS user with Domain\UserName format.
3 From Linux/Unix Machine , use the --ntlm and --user parameter to pass the domain account in cURL
curl 'http://PVWAIP/AIMWebService/api/Accounts?AppID=ApplicationNmae&Safe=TestSafe&Object=AccountObjectName' --header 'Content-Type:application/json' --ntlm --user 'Domain\UserName'