Skip the login page
I have a website which contains link to another application. That application requires username and password for authentication.I want that when someone clicks on the link, he should be redirected to welcome page(instead login page). I will provide username and password internally,thus skipping the login page. Is there a way to do so?
NOTE: All users will have same username & password.
You should explain more about the authentication and authorization mechanisms you're using. Its also hard to give you any sample code because you haven't said what language you're using.
You might consider hard coding it into the page the link follows and then redirect them (write response headers to redirect them or output a html redirection). Before you write the headers you'll call whatever mechanism you use to authenticate them and then I assume you don't reauthenticate them for every request, so they'll be logged in until they log out or their session expires. They'll never even need to know the credentials for the account they're using.
If they're already logged in you'll need to overwrite the username they're authenticated with, as most systems are set up to let you log in as a single user.
There are a lot of ways to handle this situation, I can probably come up with 10 which are all fine.
It's really only a couple lines of code... I might as well just post it in PHP:
You might need to figure out how to bypass the authentication system- but it's usually as easy as writing user into a session. That user probably needs to exist inside the database too.
//you might consider changing the save path- /tmp/ is only so big and there's a lot of people on a shared host
$_SESSION['user'] = 'The username you want them to be';
header("Location: http://www. whatever url you want");
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)