- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.
08-30-2024 01:18 AM
We user the SaaS version of cyberark EPM; I found discussion https://community.cyberark.com/s/question/0D52J000097AzDWSA0/how-can-we-use-saml-authentication-to-m... and other saying more or less the same thing, but we're unable to get it working.
$url="https://it.epm.cyberark.com/SAML/Logon";
$ch=curl_init($url);
curl_setopt($ch,CURLOPT_POSTFIELDS,"SAMLResponse=" . urlencode($token1));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$result = curl_exec($ch);
curl_close($ch);
print_r($result);
but I always get
{"StatusCode":401,"Error":"Authentication is required and has failed or has not yet been provided"}
08-30-2024 06:18 AM
I guess to get the IDP token you should use the URL that point to your IDP server. You can find it from EPM console Administration > SAML Integration page.
08-30-2024 06:18 AM
I guess to get the IDP token you should use the URL that point to your IDP server. You can find it from EPM console Administration > SAML Integration page.
08-30-2024 06:42 AM
It worked!
I was missing the fact that I need to use the URL provided by Cyberark, and I was using the LoginURL provided by the IdP for Idp-Initiated sessions .
I repeated everything starting from the url found on the SAML integration, and I used the sample script that I found in powershell:
Import-Module -name .\PS-SAML-Interactive.psm1
$LoginURL = 'https://eu.epm.cyberark.com/SAML/XXXXX'
$SAMLResponse = New-SAMLInteractive -LoginIDP $loginURL
$DispatcherURL = "https://eu.epm.cyberark.com/SAML/Logon"
$Method = "POST"
$Headers = @{"Content-Type" = "application/x-www-form-urlencoded"}
$SAMLAuthBody = @{SAMLResponse= "$SAMLResponse"}
$SAMLAuthResponse = Invoke-RestMethod -Uri $DispatcherURL -Method $Method -Headers $Headers -Body $SAMLAuthBody
$SAMLAuthResponse
now I'll revert to my PHP Scripts. thank you
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!

