Class: OpenID::Server::OpenIDResponse

### Home Classes Methods

### In Files

- lib/openid/server.rb

### Parent

Object

### Methods

- ::new
- #add_extension
- #copy
- #encode_to_kvform
- #encode_to_url
- #needs_signing
- #render_as_form
- #to_form_markup
- #to_html
- #to_s
- #which_encoding

### 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::Server::OpenIDResponse

I am a response to an OpenID request.

Attributes:

signed | A list of the names of the fields which should be signed.

Implementer's note: In a more symmetric client/server implementation, there would be more types of #OpenIDResponse object and they would have validated attributes according to the type of response. But as it is, Response objects in a server are basically write-only, their only job is to go out over the wire, so this is just a loose wrapper around #OpenIDResponse.fields.

### Attributes

fields[RW]

An #OpenID::Message with the data to be returned. Keys are parameter names with no leading openid. e.g. identity and mac_key never openid.identity.

request[RW]

The #OpenIDRequest I respond to.

### Public Class Methods

new(request) click to toggle source

    # File lib/openid/server.rb, line 860
    def initialize(request)
      # Make a response to an OpenIDRequest.
      @request = request
      @fields = Message.new(request.namespace)
    end

### Public Instance Methods

add_extension(extension_response) click to toggle source

    # File lib/openid/server.rb, line 922
    def add_extension(extension_response)
      # Add an extension response to this response message.
      #
      # extension_response:: An object that implements the
      #     #OpenID::Extension interface for adding arguments to an OpenID
      #     message.
      extension_response.to_message(@fields)
    end

copy() click to toggle source

    # File lib/openid/server.rb, line 943
    def copy
      return Marshal.load(Marshal.dump(self))
    end

encode_to_kvform() click to toggle source

    # File lib/openid/server.rb, line 931
    def encode_to_kvform
      # Encode a response in key-value colon/newline format.
      #
      # This is a machine-readable format used to respond to
      # messages which came directly from the consumer and not
      # through the user agent.
      #
      # see: OpenID Specs,
      #    <a href="http://openid.net/specs.bml#keyvalue">Key-Value Colon/Newline format</a>
      return @fields.to_kvform
    end

encode_to_url() click to toggle source

    # File lib/openid/server.rb, line 916
    def encode_to_url
      # Encode a response as a URL for the user agent to GET.
      # You will generally use this URL with a HTTP redirect.
      return @fields.to_url(@request.return_to)
    end

needs_signing() click to toggle source

    # File lib/openid/server.rb, line 894
    def needs_signing
      # Does this response require signing?
      return @fields.get_arg(OPENID_NS, 'mode') == 'id_res'
    end

render_as_form() click to toggle source

    # File lib/openid/server.rb, line 888
    def render_as_form
      # Returns true if this response's encoding is
      # ENCODE_HTML_FORM.  Convenience method for server authors.
      return self.which_encoding == ENCODE_HTML_FORM
    end

to_form_markup(form_tag_attrs=nil) click to toggle source

form_tag_attrs is a hash of attributes to be added to the form tag. 'accept-charset' and 'enctype' have defaults that can be overridden. If a value is supplied for 'action' or 'method', it will be replaced. Returns the form markup for this response.

    # File lib/openid/server.rb, line 878
    def to_form_markup(form_tag_attrs=nil)
      return @fields.to_form_markup(@request.return_to, form_tag_attrs)
    end

to_html(form_tag_attrs=nil) click to toggle source

Wraps the form tag from to_form_markup in a complete HTML document that uses javascript to autosubmit the form.

    # File lib/openid/server.rb, line 884
    def to_html(form_tag_attrs=nil)
      return Util.auto_submit_html(to_form_markup(form_tag_attrs))
    end

to_s() click to toggle source

    # File lib/openid/server.rb, line 866
    def to_s
      return sprintf("%s for %s: %s",
                     self.class,
                     @request.class,
                     @fields)
    end

which_encoding() click to toggle source

implements IEncodable

    # File lib/openid/server.rb, line 901
    def which_encoding
      # How should I be encoded?
      # returns one of ENCODE_URL or ENCODE_KVFORM.
      if BROWSER_REQUEST_MODES.member?(@request.mode)
        if @fields.is_openid2 and
            encode_to_url.length > OPENID1_URL_LIMIT
          return ENCODE_HTML_FORM
        else
          return ENCODE_URL
        end
      else
        return ENCODE_KVFORM
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.