Class: WardenOauthProvider::Token::Request
- Defined in:
- lib/warden_oauth_provider/token/request.rb
Instance Method Summary collapse
- #authorize!(user) ⇒ Object
- #exchange!(verifier) ⇒ Object
-
#oob? ⇒ Boolean
TODO: check what the requirements for OOB are.
Methods inherited from Base
#authorized?, #invalidate!, #invalidated?
Instance Method Details
#authorize!(user) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/warden_oauth_provider/token/request.rb', line 7 def (user) return false if or user.nil? self.user = user self. = Time.now self.verifier = OAuth::Helper.generate_key(20)[0,20] self.save end |
#exchange!(verifier) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/warden_oauth_provider/token/request.rb', line 15 def exchange!(verifier) return false unless return false if self.verifier != verifier self::class.transaction do access_token = WardenOauthProvider::Token::Access.create!(:user => user, :client_application => client_application) invalidate! access_token end end |
#oob? ⇒ Boolean
TODO: check what the requirements for OOB are
26 27 28 |
# File 'lib/warden_oauth_provider/token/request.rb', line 26 def oob? self.callback_url.blank? || self.callback_url == 'oob' end |