class OpenID::Server::SigningEncoder
I encode responses in to WebResponses, signing them when required.
Attributes
signatory[RW]
Public Class Methods
new(signatory)
click to toggle source
Create a SigningEncoder given a Signatory
# File lib/openid/server.rb, line 1185 def initialize(signatory) @signatory = signatory end
Public Instance Methods
encode(response)
click to toggle source
Encode a response to a WebResponse, signing it first if appropriate.
Raises EncodingError when I can't figure out how to encode this message.
Raises AlreadySigned when this response is already signed.
Calls superclass method
OpenID::Server::Encoder#encode
# File lib/openid/server.rb, line 1196 def encode(response) # the is_a? is a bit of a kludge... it means there isn't # really an adapter to make the interfaces quite match. if !response.is_a?(Exception) and response.needs_signing() if !@signatory raise ArgumentError.new( sprintf("Must have a store to sign this request: %s", response), response) end if response.fields.has_key?(OPENID_NS, 'sig') raise AlreadySigned.new(response) end response = @signatory.sign(response) end return super(response) end