Programmatically Login From Plugin I'm writing an LDAP authentication plugin, which, if the authentication matches, will log the user into a 'general' username/password, in order to view a protected page.  The 'general' username/password is part of a usergroup with restricted priveleges. 

In my plugin, in the controller file, I have this:

craft()-&gt;userSession-&gt;login($username, $password);


with the $username and $password variables set just above that.  However, the login process does not appear to be happening, as my check in my template is not displaying the username:

{% if currentUser %}
Welcome, {{ currentUser.friendlyName }}!
{% endif %}


However, when I log on as that 'general' username/password, from the login page, and then refresh my template, it does show that the login for that profile has successfully occurred.  

What may need to be done to effect a successful login, in the plugin?
Thanks!
If you want to login a user, you need to use the login function

craft()-&gt;userSession-&gt;login($loginName, $password, $rememberMe))