LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to authenticate against SSO when using wget (https://www.linuxquestions.org/questions/programming-9/how-to-authenticate-against-sso-when-using-wget-831133/)

manya 09-09-2010 02:40 AM

How to authenticate against SSO when using wget
 
Hi All,

I am writing a bash script where I would need to down load few file from server but the glitch is authentication is being performed by SSO/Siteminder server.
Does anyone aware of a option or trick with wget or curl to authenticate against SSO and then download the file from the server.

Standard http-user and http-password definitely does not suffice the need.

marozsas 09-11-2010 04:27 PM

I don't know how Siteminder authenticate his users, but there is a big chance it uses a POST method to do it.
wget or curls will not work because they can't handle HTTP/POST as a browser does. Try lynx.

Based on another authenticated site, I developed a bash script to authenticate and download files. I hope it can help you as a starting point.

Code:

USERNAME="myusername";          ### replace with your username  ###
PASSWORD="password";            ### replace with your password  ###

POST_DATA="username=$USERNAME&password=$PASSWORD";  # you must check how the username and password are expected by siteminder.

SITEMINDERLOGON="http://siteminder/servlet/logon?option1=whatever&option2=whatever2&username=$USERNAME&password=$PASSWORD"

# the above string is the key here. It is the how siteminder expects an answer when you hit the login button on your browser. You must reproduce the exact string and this could be tricky. Inspecting the source code of auhtentication page may help.

echo -e $POST_DATA | lynx --dump --accept_all_cookies -post_data $SITEMINDERLOGON

# after that lynx holds a session using cockies. No authentication is needed from this point
lynx --dump --accept_all_cookies http://siteminder/path/to/your/file > saved_file



All times are GMT -5. The time now is 05:23 AM.