]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/oauth-plugin/generators/oauth_provider/templates/request_token.rb
Merge 16110:16487 from trunk.
[rails.git] / vendor / plugins / oauth-plugin / generators / oauth_provider / templates / request_token.rb
1 class RequestToken < OauthToken
2   def authorize!(user)
3     return false if authorized?
4     self.user = user
5     self.authorized_at = Time.now
6     self.save
7   end
8   
9   def exchange!
10     return false unless authorized?
11     RequestToken.transaction do
12       access_token = AccessToken.create(:user => user, :client_application => client_application)
13       invalidate!
14       access_token
15     end
16   end
17 end