gonzalo-bulnes/simple_token_authentication — pull request #119 by wielinde (2014-10-16 09:15:24+00:00)
Title: Allow for using any model field as identifier and not only :email.

Hi everybody,

Thank you for providing this Gem. It is a real pain killer. Unfortunately I ran into troubles when I did not have the email of a user. So I changed this gem for allowing other fields for identifying a model than only :email.

Please be so kind an consider this pull request.

# Scenario

- As a developer of mobile applications,
- when I want to realize token based authentication after a Facebook login
- and the user denied the provision of her email address
- then I still want to be able to use token based authentication but using a model field that is different from "email".
- Further, old configurations of simple_token_authentication should still work as before.

# The solution in this pull request

I changed the format for header_names. It now provides the options `identifier_field` and `identifier`, where `identifier` holds the HTTP-Header-Name that shall be used for providing the identifier such as "X-User-Uuid". `identifier_name` holds a Symbol which tells which model field shall be used, such as ":email" or ":uuid".

Please feel free to contact me.