Log in without password
Have a look at 

user_external_login_register


  Helper function for authentication modules. Either logs in or
  registers the current user, based on username. Either way, the global
  $user object is populated and login tasks are performed.


The example at: 

https://api.drupal.org/comment/13434#comment-13434

Is a worthwhile read too.