Login/authentication system for a website

97 Views Asked by At

Hello and thank you for your time,

Ive made a website that I wish to be published and accessible only to the college I attend. The easiest way I can imagine accomplishing this is to make use of the already existing login system that we use campus wide. The issue is that our campus does not have any implementation for third party authentication. I've asked my professor who manages part of the website and he said they would allow the use of it if it were created, but I would not be able to use any form of API or any of their web services because it's not available for third parties.

Would it be possible for my website to check if the user was logged into the campus webmail or moodle and then authenticate the user to use my website?

The solution doesn't have to be complex, but if possible it would need to include how to implement the already existing login system.

Thank you for your time

1

There are 1 best solutions below

0
On BEST ANSWER

What you are wanting to do (if i understand correctly) is an EXTREMELY bad idea security wise. If anybody who has worked on their website is worth anything any method you could use for this is already blocked. That being said I can give you a theoretical way of doing it and if it works you should go to your professor and tell them to stop it.

There is no way you can use javascript/html to directly do what you want so that is out http://en.wikipedia.org/wiki/Same-origin_policy

What you can do though is have your logon form kick it back to your own server where you have a php script written to use curl.

http://php.net/manual/en/function.curl-init.php

You will need to login to your college website and see if/what post data is send and then use curlopt to mimic them.. Changing the post username/password with those provided from your form on your website.

Read the response from your curl request and look for unique identifiers between a good login and a bad (i.e "Incorrect username" for bad "Welcome back" for good) Pull the other info you need i.e. div id=name>This

Then redirect your client to your logged in page/alert to incorrect password.

Anywho you should be able to figure it out just with ajax/curl (if your college has not blocked it) if you need help with the actual code comment on here but most of it will come down to your CURLOPT_POSTFIELDS / CURLOPT_REFERER etc etc which i cannot give you you can easily get with firebug or the like though