ncbo / goo

Graph Oriented Objects (GOO) for Ruby. A RDF/SPARQL based ORM.
http://ncbo.github.io/goo/
Other
15 stars 6 forks source link

Support password fields / user objects #73

Open palexander opened 11 years ago

palexander commented 11 years ago

It would be interesting if Goo supported encrypted passwords:

class User
  attribute :username, :unique => true
  attribute :password, :password => true
end

Under the hood, Goo would encrypt the value passed to :password and store the hash. To authenticate a user, you could

# Good user/pass combo
u = User.where(username: "paul", password: "12345")
=> [ <User: "paul"> ]
# Bad user/pass combo
u = User.where(username: "paul", password: "54321")
=> [  ]

or a specialized method

# Good
u = User.authenticate("paul", "12345")
=> <User: "paul">
# Bad
u = User.authenticate("paul", "54321")
=> nil

Just food for thought, no priority at all