Exception: OpenID::Server::ProtocolError
- Inherits:
-
Exception
- Object
- Exception
- OpenID::Server::ProtocolError
- Defined in:
- lib/openid/server.rb
Overview
A message did not conform to the OpenID protocol.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#contact ⇒ Object
Returns the value of attribute contact.
-
#openid_message ⇒ Object
The query that is failing to be a valid OpenID request.
-
#reference ⇒ Object
Returns the value of attribute reference.
Instance Method Summary collapse
- #encode_to_kvform ⇒ Object
-
#encode_to_url ⇒ Object
implements IEncodable.
-
#get_return_to ⇒ Object
Get the return_to argument from the request, if any.
-
#has_return_to ⇒ Object
Did this request have a return_to parameter?.
-
#initialize(message, text = nil, reference = nil, contact = nil) ⇒ ProtocolError
constructor
- text
-
A message about the encountered error.
- #to_form_markup ⇒ Object
- #to_html ⇒ Object
-
#to_message ⇒ Object
Generate a Message object for sending to the relying party, after encoding.
-
#which_encoding ⇒ Object
How should I be encoded?.
Constructor Details
#initialize(message, text = nil, reference = nil, contact = nil) ⇒ ProtocolError
- text
-
A message about the encountered error.
1394 1395 1396 1397 1398 1399 1400 |
# File 'lib/openid/server.rb', line 1394 def initialize(, text=nil, reference=nil, contact=nil) @openid_message = @reference = reference @contact = contact Util.assert(!.is_a?(String)) super(text) end |
Instance Attribute Details
#contact ⇒ Object
Returns the value of attribute contact.
1391 1392 1393 |
# File 'lib/openid/server.rb', line 1391 def contact @contact end |
#openid_message ⇒ Object
The query that is failing to be a valid OpenID request.
1389 1390 1391 |
# File 'lib/openid/server.rb', line 1389 def @openid_message end |
#reference ⇒ Object
Returns the value of attribute reference.
1390 1391 1392 |
# File 'lib/openid/server.rb', line 1390 def reference @reference end |
Instance Method Details
#encode_to_kvform ⇒ Object
1441 1442 1443 |
# File 'lib/openid/server.rb', line 1441 def encode_to_kvform return ().to_kvform() end |
#encode_to_url ⇒ Object
implements IEncodable
1437 1438 1439 |
# File 'lib/openid/server.rb', line 1437 def encode_to_url return ().to_url(get_return_to()) end |
#get_return_to ⇒ Object
Get the return_to argument from the request, if any.
1403 1404 1405 1406 1407 1408 1409 |
# 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 ⇒ Object
Did this request have a return_to parameter?
1412 1413 1414 |
# File 'lib/openid/server.rb', line 1412 def has_return_to return !get_return_to.nil? end |
#to_form_markup ⇒ Object
1445 1446 1447 |
# File 'lib/openid/server.rb', line 1445 def to_form_markup return ().to_form_markup(get_return_to()) end |
#to_html ⇒ Object
1449 1450 1451 |
# File 'lib/openid/server.rb', line 1449 def to_html return Util.auto_submit_html(to_form_markup) end |
#to_message ⇒ Object
Generate a Message object for sending to the relying party, after encoding.
1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 |
# File 'lib/openid/server.rb', line 1418 def 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 ⇒ Object
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.
1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 |
# 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 |