File: legacy.rb

package info (click to toggle)
ruby-rack-oauth2 1.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 624 kB
  • sloc: ruby: 4,482; makefile: 4
file content (19 lines) | stat: -rw-r--r-- 410 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Rack
  module OAuth2
    class AccessToken
      class Legacy < AccessToken
        def initialize(attributes = {})
          super
          self.expires_in = (
            self.expires_in ||
            attributes[:expires]
          ).try(:to_i)
        end

        def authenticate(request)
          request.header["Authorization"] = "OAuth #{access_token}"
        end
      end
    end
  end
end