Class: OpenID::Server::ProtocolError

### Home Classes Methods

### In Files

- lib/openid/server.rb

### Parent

Exception

### Methods

- ::new
- #encode_to_kvform
- #encode_to_url
- #get_return_to
- #has_return_to
- #to_form_markup
- #to_html
- #to_message
- #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::ProtocolError

A message did not conform to the OpenID protocol.

### Attributes

contact[RW]
openid_message[RW]

The query that is failing to be a valid OpenID request.

reference[RW]

### Public Class Methods

new(message, text=nil, reference=nil, contact=nil) click to toggle source

text | A message about the encountered error.

    # File lib/openid/server.rb, line 1394
    def initialize(message, text=nil, reference=nil, contact=nil)
      @openid_message = message
      @reference = reference
      @contact = contact
      Util.assert(!message.is_a?(String))
      super(text)
    end

### Public Instance Methods

encode_to_kvform() click to toggle source

    # File lib/openid/server.rb, line 1441
    def encode_to_kvform
      return to_message().to_kvform()
    end

encode_to_url() click to toggle source

implements IEncodable

    # File lib/openid/server.rb, line 1437
    def encode_to_url
      return to_message().to_url(get_return_to())
    end

get_return_to() click to toggle source

Get the return_to argument from the request, if any.

    # File lib/openid/server.rb, line 1403
    def get_return_to
      if @openid_message.nil?
        return nil
      else
        return @openid_message.get_arg(OPENID_NS, 'return_to')
      end
    end

has_return_to() click to toggle source

Did this request have a return_to parameter?

    # File lib/openid/server.rb, line 1412
    def has_return_to
      return !get_return_to.nil?
    end

to_form_markup() click to toggle source

    # File lib/openid/server.rb, line 1445
    def to_form_markup
      return to_message().to_form_markup(get_return_to())
    end

to_html() click to toggle source

    # File lib/openid/server.rb, line 1449
    def to_html
      return Util.auto_submit_html(to_form_markup)
    end

to_message() click to toggle source

Generate a Message object for sending to the relying party, after encoding.

    # File lib/openid/server.rb, line 1418
    def to_message
      namespace = @openid_message.get_openid_namespace()
      reply = Message.new(namespace)
      reply.set_arg(OPENID_NS, 'mode', 'error')
      reply.set_arg(OPENID_NS, 'error', self.to_s)

      if @contact
        reply.set_arg(OPENID_NS, 'contact', @contact.to_s)
      end

      if @reference
        reply.set_arg(OPENID_NS, 'reference', @reference.to_s)
      end

      return reply
    end

which_encoding() click to toggle source

How should I be encoded?

Returns one of ENCODE_URL, ENCODE_KVFORM, or None. If None, I cannot be encoded as a protocol message and should be displayed to the user.

    # File lib/openid/server.rb, line 1458
    def which_encoding
      if has_return_to()
        if @openid_message.is_openid2 and
            encode_to_url().length > OPENID1_URL_LIMIT
          return ENCODE_HTML_FORM
        else
          return ENCODE_URL
        end
      end

      if @openid_message.nil?
        return nil
      end

      mode = @openid_message.get_arg(OPENID_NS, 'mode')
      if mode
        if !BROWSER_REQUEST_MODES.member?(mode)
          return ENCODE_KVFORM
        end
      end

      # If your request was so broken that you didn't manage to
      # include an openid.mode, I'm not going to worry too much
      # about returning you something you can't parse.
      return nil
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.