Class: OpenID::Consumer::SuccessResponse
- Inherits:
-
Object
- Object
- OpenID::Consumer::SuccessResponse
- Includes:
- Response
- Defined in:
- lib/openid/consumer/responses.rb
Overview
A successful acknowledgement from the OpenID server that the supplied URL is, indeed controlled by the requesting agent.
Constant Summary collapse
- STATUS =
SUCCESS
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#signed_fields ⇒ Object
readonly
Returns the value of attribute signed_fields.
Attributes included from Response
Instance Method Summary collapse
-
#extension_response(namespace_uri, require_signed) ⇒ Object
Return response arguments in the specified namespace.
-
#get_signed(ns_uri, ns_key, default = nil) ⇒ Object
Return the specified signed field if available, otherwise return default.
-
#get_signed_ns(ns_uri) ⇒ Object
Get signed arguments from the response message.
-
#initialize(endpoint, message, signed_fields) ⇒ SuccessResponse
constructor
A new instance of SuccessResponse.
-
#is_openid1 ⇒ Object
Was this authentication response an OpenID 1 authentication response?.
-
#signed?(ns_uri, ns_key) ⇒ Boolean
Return whether a particular key is signed, regardless of its namespace alias.
Methods included from Response
#display_identifier, #identity_url, #status
Constructor Details
#initialize(endpoint, message, signed_fields) ⇒ SuccessResponse
Returns a new instance of SuccessResponse.
61 62 63 64 65 66 67 68 |
# File 'lib/openid/consumer/responses.rb', line 61 def initialize(endpoint, , signed_fields) # Don't use :endpoint=, because endpoint should never be nil # for a successfull transaction. @endpoint = endpoint @identity_url = endpoint.claimed_id = @signed_fields = signed_fields end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
59 60 61 |
# File 'lib/openid/consumer/responses.rb', line 59 def end |
#signed_fields ⇒ Object (readonly)
Returns the value of attribute signed_fields.
59 60 61 |
# File 'lib/openid/consumer/responses.rb', line 59 def signed_fields @signed_fields end |
Instance Method Details
#extension_response(namespace_uri, require_signed) ⇒ Object
Return response arguments in the specified namespace. If require_signed is true and the arguments are not signed, return nil.
104 105 106 107 108 109 110 |
# File 'lib/openid/consumer/responses.rb', line 104 def extension_response(namespace_uri, require_signed) if require_signed get_signed_ns(namespace_uri) else .get_args(namespace_uri) end end |
#get_signed(ns_uri, ns_key, default = nil) ⇒ Object
Return the specified signed field if available, otherwise return default
84 85 86 87 88 |
# File 'lib/openid/consumer/responses.rb', line 84 def get_signed(ns_uri, ns_key, default = nil) return .get_arg(ns_uri, ns_key, default) if signed?(ns_uri, ns_key) default end |
#get_signed_ns(ns_uri) ⇒ Object
Get signed arguments from the response message. Return a dict of all arguments in the specified namespace. If any of the arguments are not signed, return nil.
93 94 95 96 97 98 99 |
# File 'lib/openid/consumer/responses.rb', line 93 def get_signed_ns(ns_uri) msg_args = .get_args(ns_uri) msg_args.each_key do |key| return nil unless signed?(ns_uri, key) end msg_args end |
#is_openid1 ⇒ Object
Was this authentication response an OpenID 1 authentication response?
72 73 74 |
# File 'lib/openid/consumer/responses.rb', line 72 def is_openid1 .is_openid1 end |
#signed?(ns_uri, ns_key) ⇒ Boolean
Return whether a particular key is signed, regardless of its namespace alias
78 79 80 |
# File 'lib/openid/consumer/responses.rb', line 78 def signed?(ns_uri, ns_key) @signed_fields.member?(.get_key(ns_uri, ns_key)) end |