class OpenID::OAuth::Request

An OAuth token request, sent from a relying party to a provider

Attributes

consumer[RW]
ns_alias[RW]
ns_uri[RW]
scope[RW]

Public Class Methods

from_openid_request(oid_req) click to toggle source

Instantiate a Request object from the arguments in a checkid_* OpenID message return nil if the extension was not requested.

# File lib/openid/extensions/oauth.rb, line 33
def self.from_openid_request(oid_req)
  oauth_req = new
  args = oid_req.message.get_args(NS_URI)
  if args == {}
    return nil
  end
  oauth_req.parse_extension_args(args)
  return oauth_req
end
new(consumer=nil, scope=nil) click to toggle source
# File lib/openid/extensions/oauth.rb, line 15
def initialize(consumer=nil, scope=nil)
  @ns_alias = 'oauth'
  @ns_uri = NS_URI
  @consumer = consumer
  @scope = scope
end

Public Instance Methods

get_extension_args() click to toggle source
# File lib/openid/extensions/oauth.rb, line 23
def get_extension_args
  ns_args = {}
  ns_args['consumer'] = @consumer if @consumer        
  ns_args['scope'] = @scope if @scope
  return ns_args
end
parse_extension_args(args) click to toggle source

Set the state of this request to be that expressed in these OAuth arguments

# File lib/openid/extensions/oauth.rb, line 45
def parse_extension_args(args)
  @consumer = args["consumer"]
  @scope = args["scope"]
end