Class: OpenID::SReg::Response

### Home Classes Methods

### In Files

- lib/openid/extensions/sreg.rb

### Parent

OpenID::Extension

### Methods

- ::extract_response
- ::from_success_response
- ::new
- #[]
- #empty?
- #get_extension_args

### Files

- LICENSE

### Class/Module Index

Quicksearch

- OpenID
- OpenID::AX
- OpenID::AX::AXMessage
- OpenID::AX::AttrInfo
- OpenID::AX::Error
- OpenID::AX::FetchRequest
- OpenID::AX::FetchResponse
- OpenID::AX::KeyValueMessage
- OpenID::AX::StoreRequest
- OpenID::AX::StoreResponse
- OpenID::AssertionError
- OpenID::Association
- OpenID::AssociationNegotiator
- OpenID::Consumer
- OpenID::Consumer::AssociationManager
- OpenID::Consumer::CancelResponse
- OpenID::Consumer::CheckIDRequest
- OpenID::Consumer::DiffieHellmanSHA1Session
- OpenID::Consumer::DiffieHellmanSHA256Session
- OpenID::Consumer::DiffieHellmanSession
- OpenID::Consumer::DiscoveredServices
- OpenID::Consumer::DiscoveryManager
- OpenID::Consumer::FailureResponse
- OpenID::Consumer::IdResHandler
- OpenID::Consumer::NoEncryptionSession
- OpenID::Consumer::Response
- OpenID::Consumer::Session
- OpenID::Consumer::SetupNeededResponse
- OpenID::Consumer::SuccessResponse
- OpenID::CryptUtil
- OpenID::DiffieHellman
- OpenID::DiscoveryFailure
- OpenID::Extension
- OpenID::FetchingError
- OpenID::HTTPRedirectLimitReached
- OpenID::HTTPResponse
- OpenID::HTTPStatusError
- OpenID::InvalidOpenIDNamespace
- OpenID::KVFormError
- OpenID::KVPostNetworkError
- OpenID::Message
- OpenID::Message::KeyNotFound
- OpenID::NamespaceAliasRegistrationError
- OpenID::NamespaceMap
- OpenID::Nonce
- OpenID::OAuth
- OpenID::OAuth::Request
- OpenID::OAuth::Response
- OpenID::OpenIDError
- OpenID::OpenIDServiceEndpoint
- OpenID::PAPE
- OpenID::PAPE::Request
- OpenID::PAPE::Response
- OpenID::ProtocolError
- OpenID::RealmVerificationRedirected
- OpenID::SReg
- OpenID::SReg::NamespaceError
- OpenID::SReg::Request
- OpenID::SReg::Response
- OpenID::SSLFetchingError
- OpenID::Server
- OpenID::Server::AlreadySigned
- OpenID::Server::AssociateRequest
- OpenID::Server::BaseServerSession
- OpenID::Server::CheckAuthRequest
- OpenID::Server::CheckIDRequest
- OpenID::Server::Decoder
- OpenID::Server::DiffieHellmanSHA1ServerSession
- OpenID::Server::DiffieHellmanSHA256ServerSession
- OpenID::Server::Encoder
- OpenID::Server::EncodingError
- OpenID::Server::MalformedReturnURL
- OpenID::Server::MalformedTrustRoot
- OpenID::Server::NoReturnToError
- OpenID::Server::OpenIDRequest
- OpenID::Server::OpenIDResponse
- OpenID::Server::PlainTextServerSession
- OpenID::Server::ProtocolError
- OpenID::Server::Server
- OpenID::Server::Signatory
- OpenID::Server::SigningEncoder
- OpenID::Server::UntrustedReturnURL
- OpenID::Server::VersionError
- OpenID::Server::WebResponse
- OpenID::ServerError
- OpenID::StandardFetcher
- OpenID::Store
- OpenID::Store::Filesystem
- OpenID::Store::Interface
- OpenID::Store::Memcache
- OpenID::Store::Memory
- OpenID::TrustRoot
- OpenID::TrustRoot::TrustRoot
- OpenID::TypeURIMismatch
- OpenID::UI
- OpenID::UI::Request
- OpenID::URINorm
- OpenID::UndefinedOpenIDNamespace
- OpenID::Util
- OpenID::Yadis
- OpenID::Yadis::BasicServiceEndpoint
- OpenID::Yadis::CompoundFilter
- OpenID::Yadis::DiscoveryResult
- OpenID::Yadis::TransformFilterMaker
- OpenID::Yadis::XRDSError
- OpenID::Yadis::XRDSFraud
- OpenID::Yadis::XRI
- OpenID::Yadis::XRI::ProxyResolver
- OpenID::Yadis::XRI::XRIHTTPError
- HMAC
- HMAC::Base
- HMAC::SHA1
- HMAC::SHA256
- HMAC::SHA384
- HMAC::SHA512
- Net
- Net::HTTP
- HTMLComment
- HTMLTag
- HTMLText
- HTMLToken
- HTMLTokenizer
- HTMLTokenizerError
- Object

No matching classes.

# OpenID::SReg::Response

Represents the data returned in a simple registration response inside of an OpenID id_res response. This object will be created by the OpenID server, added to the id_res response object, and then extracted from the id_res message by the Consumer.

### Attributes

data[R]
ns_uri[R]

### Public Class Methods

extract_response(request, data) click to toggle source

Take a Request and a hash of simple registration values and create a Response object containing that data.

    # File lib/openid/extensions/sreg.rb, line 235
    def self.extract_response(request, data)
      arf = request.all_requested_fields
      resp_data = data.reject{|k,v| !arf.member?(k) || v.nil? }
      new(resp_data, request.ns_uri)
    end

from_success_response(success_response, signed_only = true) click to toggle source

Create an Response object from an OpenID::Consumer::SuccessResponse from consumer.complete If you set the signed_only parameter to false, unsigned data from the id_res message from the server will be processed.

    # File lib/openid/extensions/sreg.rb, line 245
    def self.from_success_response(success_response, signed_only = true)
      ns_uri = OpenID::get_sreg_ns(success_response.message)
      if signed_only
        args = success_response.get_signed_ns(ns_uri)
        return nil if args.nil? # No signed args, so fail
      else
        args = success_response.message.get_args(ns_uri)
      end
      args.reject!{|k,v| !DATA_FIELDS.member?(k) }
      new(args, ns_uri)
    end

new(data = {}, ns_uri=NS_URI) click to toggle source

    # File lib/openid/extensions/sreg.rb, line 227
    def initialize(data = {}, ns_uri=NS_URI)
      @ns_alias = 'sreg'
      @data = data
      @ns_uri = ns_uri
    end

### Public Instance Methods

[](field_name) click to toggle source

Read-only hashlike interface. Raises an exception if the field name is bad

    # File lib/openid/extensions/sreg.rb, line 265
    def [](field_name)
      OpenID::check_sreg_field_name(field_name)
      data[field_name]
    end

empty?() click to toggle source

    # File lib/openid/extensions/sreg.rb, line 270
    def empty?
      @data.empty?
    end

get_extension_args() click to toggle source

Get the fields to put in the simple registration namespace when adding them to an id_res message.

    # File lib/openid/extensions/sreg.rb, line 259
    def get_extension_args
      return @data
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.