Class: OpenID::OAuth::Response
- Defined in:
- lib/openid/extensions/oauth.rb
Overview
A OAuth request token response, sent from a provider to a relying party
Instance Attribute Summary collapse
-
#request_token ⇒ Object
Returns the value of attribute request_token.
-
#scope ⇒ Object
Returns the value of attribute scope.
Class Method Summary collapse
-
.from_success_response(success_response) ⇒ Object
Create a Response object from an OpenID::Consumer::SuccessResponse.
Instance Method Summary collapse
- #get_extension_args ⇒ Object
-
#initialize(request_token = nil, scope = nil) ⇒ Response
constructor
A new instance of Response.
-
#parse_extension_args(args, _strict = false) ⇒ Object
parse the oauth request arguments into the internal state of this object if strict is specified, raise an exception when bad data is encountered.
Methods inherited from Extension
Constructor Details
#initialize(request_token = nil, scope = nil) ⇒ Response
Returns a new instance of Response.
54 55 56 57 58 59 |
# File 'lib/openid/extensions/oauth.rb', line 54 def initialize(request_token = nil, scope = nil) @ns_alias = "oauth" @ns_uri = NS_URI @request_token = request_token @scope = scope end |
Instance Attribute Details
#request_token ⇒ Object
Returns the value of attribute request_token.
52 53 54 |
# File 'lib/openid/extensions/oauth.rb', line 52 def request_token @request_token end |
#scope ⇒ Object
Returns the value of attribute scope.
52 53 54 |
# File 'lib/openid/extensions/oauth.rb', line 52 def scope @scope end |
Class Method Details
.from_success_response(success_response) ⇒ Object
Create a Response object from an OpenID::Consumer::SuccessResponse
62 63 64 65 66 67 68 69 |
# File 'lib/openid/extensions/oauth.rb', line 62 def self.from_success_response(success_response) args = success_response.get_signed_ns(NS_URI) return if args.nil? oauth_resp = new oauth_resp.parse_extension_args(args) oauth_resp end |
Instance Method Details
#get_extension_args ⇒ Object
80 81 82 83 84 85 |
# File 'lib/openid/extensions/oauth.rb', line 80 def get_extension_args ns_args = {} ns_args["request_token"] = @request_token if @request_token ns_args["scope"] = @scope if @scope ns_args end |
#parse_extension_args(args, _strict = false) ⇒ Object
parse the oauth request arguments into the internal state of this object if strict is specified, raise an exception when bad data is encountered
75 76 77 78 |
# File 'lib/openid/extensions/oauth.rb', line 75 def parse_extension_args(args, _strict = false) @request_token = args["request_token"] @scope = args["scope"] end |