Class: Rack::OAuth2::AccessToken

Inherits:
Object
  • Object
show all
Includes:
AttrOptional, AttrRequired
Defined in:
lib/rack/oauth2/access_token.rb,
lib/rack/oauth2/access_token/mac.rb,
lib/rack/oauth2/access_token/legacy.rb,
lib/rack/oauth2/access_token/bearer.rb,
lib/rack/oauth2/access_token/mac/verifier.rb,
lib/rack/oauth2/access_token/mac/signature.rb,
lib/rack/oauth2/access_token/authenticator.rb,
lib/rack/oauth2/access_token/mac/sha256_hex_verifier.rb

Direct Known Subclasses

Bearer, Legacy, MAC

Defined Under Namespace

Classes: Authenticator, Bearer, Legacy, MAC

Instance Method Summary (collapse)

Constructor Details

- (AccessToken) initialize(attributes = {})



9
10
11
12
13
14
15
16
17
18
# File 'lib/rack/oauth2/access_token.rb', line 9

def initialize(attributes = {})
  (required_attributes + optional_attributes).each do |key|
    self.send :#{key}=", attributes[key]
  end
  @token_type = self.class.name.demodulize.underscore.to_sym
  @httpclient = Rack::OAuth2.http_client("#{self.class} (#{VERSION})") do |config|
    config.request_filter << Authenticator.new(self)
  end
  attr_missing!
end

Instance Method Details

- (Object) token_response(options = {})



20
21
22
23
24
25
26
27
28
# File 'lib/rack/oauth2/access_token.rb', line 20

def token_response(options = {})
  {
    :access_token => access_token,
    :refresh_token => refresh_token,
    :token_type => token_type,
    :expires_in => expires_in,
    :scope => Array(scope).join(' ')
  }
end